matplotlib

Console Only (Output Image Files)

import matplotlib
matplotlib.use('Agg')   # PNG

Example (輸出成 PNG 檔) :

import matplotlib
matplotlib.use('Agg')   # PNG

import matplotlib.pyplot as plt
import matplotlib.image as mpimg

img = mpimg.imread('input.png')
plt.hist(img.ravel(), 256, [0,256])
plt.savefig('test.png')