matplotlib savefig in jpeg format
问题 I am using matplotlib (within pylab) to display figures. And I want to save them in .jpg format. When I simply use the savefig command with jpg extension this returns : ValueError: Format \"jpg\" is not supported. Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz. Is there a way to perform this ? 回答1: You can save an image as 'png' and use the python imaging library (PIL) to convert this file to 'jpg': import Image import matplotlib.pyplot as plt plt.plot(range(10)) plt.savefig(