[Numpy-discussion] Applying PIL patch
Stéfan van der Walt
Wed Apr 2 16:25:39 CDT 2008
On Tue, Apr 1, 2008 at 10:08 AM, izak marais <email@example.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
More information about the Numpy-discussion