[SciPy-User] Trying to use PIL and numpy
alan at ajackson.org
alan at ajackson.org
Mon Jan 11 18:22:54 EST 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')
imback.save('testout.png')
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
--
-----------------------------------------------------------------------
| Alan K. Jackson | To see a World in a Grain of Sand |
| alan at ajackson.org | And a Heaven in a Wild Flower, |
| www.ajackson.org | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake |
-----------------------------------------------------------------------
More information about the SciPy-User
mailing list