[Numpy-discussion] Question about slicing
Pauli Virtanen
pav at iki.fi
Sat May 16 18:22:11 EDT 2009
Sat, 16 May 2009 22:05:16 +0000, Jorge Scandaliaris wrote:
[clip]
> I downloaded the scipy logo:
> http://docs.scipy.org/doc/_static/scipyshiny_small.png and did the
> following:
>
> img = Image.open('./scipyshiny_small.png')
>
> mpl.pylab.imshow(img) # Comes upside down
> aimg = asarray(img)
> mpl.pylab.imshow(aimg) # Comes OK
Ah, that was it. Apparently, matplotlib imshow uses a different
conversion mechanism if the input is a Image.Image from PIL, than if it
is an array. There's a dedicated function matplotlib.image.pil_to_array
which seems to work differently from asarray.
This may actually be a bug in matplotlib; perhaps you should ask the
people on the matplotlib lists if this is really the intended behavior.
--
Pauli Virtanen
More information about the NumPy-Discussion
mailing list