Saving an imshow-like image while preserving resolution
问题 I have an (n, m) array that I've been visualizing with matplotlib.pyplot.imshow . I'd like to save this data in some type of raster graphics file (e.g. a png) so that: The colors are the ones shown with imshow Each element of the underlying array is exactly one pixel in the saved image -- meaning that if the underlying array is (n, m) elements, the image is NxM pixels. (I'm not interested in interpolation='nearest' in imshow .) There is nothing in the saved image except for the pixels