[Numpy-discussion] Applying PIL patch

izak marais izakmarais@yahoo....
Tue Apr 1 03:08:00 CDT 2008

Stéfan wrote:"Unfortunately, RGBA images cannot be read this way. " 

Apparently it does not work with 16bit greyscale tif images either. 
For anyone else stumbling upon this thread, there is a work-about to get the data into a numpy array.

i = Image.open('16bitGreyscaleImage.tif')
a = numpy.array(i.getdata())    # a 1d numpy array
a = a.reshape(i.size)  #2d numpy array

Perhaps there is a better way of doing it (?), but this works for me. 


You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080401/a3c7e0bf/attachment.html 

More information about the Numpy-discussion mailing list