[SciPy-User] Trying to use PIL and numpy
Tue Jan 12 09:27:53 CST 2010
> I'm having some issues trying to use PIL and numpy (for the first time).
> It's probably something simple, it usually is.
> When I run the following, the output is all buggered up. It looks like
> the array indicies got switched about somewhere.
> import Image
> im = Image.open('test.ppm')
> im2 = im.convert(mode='F')
> a = np.asarray(im2)
> imback2 = Image.fromarray(a)
> imback = imback2.convert(mode='RGB')
> I tried removing bits, and it is the asarray -> fromarray sequence that
> messes stuff up.
> I'm running Karmic Koala with
> Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
> numpy 1.3.0
> Image 1.1.6
I believe there is a logic error in the PIL 1.1.6 fromarray() procedure
that may be relevant.
Try explicitly specifying the mode parameter in the fromarray(...) call.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User