Re: [Numpy-discussion] Applying PIL patch
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. Izak ____________________________________________________________________________________ You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. http://tc.deals.yahoo.com/tc/blockbuster/text5.com
Hi Izak On Tue, Apr 1, 2008 at 10:08 AM, izak marais <izakmarais@yahoo.com> wrote:
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.
Would you do me a favour and see whether the patch from the Image-SIG mailing list fixes your problem as well? If not, please mail me an example 16-bit greyscale tiff off-list, so that I can rework the patch. Thanks Stéfan
participants (2)
-
izak marais -
Stéfan van der Walt