[Image-SIG] Problem with converting GeoTIFF to Numpy array (ValueError: unrecognised mode)
fredrik at pythonware.com
Sat Jan 31 23:20:44 CET 2009
PIL have only limited support for the "I;16" modules; try converting
the image to mode "I" before you pass it on to NumPy.
2009/1/31 Hani Zahiri <H.Zahiri at curtin.edu.au>:
> I am trying to read a GeoTIFF and convert it to a Numpy array. Though, I am
> able to open the image with no problem, however I am keep getting
> 'ValueError: unrecognised mode' anytime I try to use any methods from PIL's
> classes. My lines and results are like this:
>>>from PIL import Image
>>>im = Image.open('dem.TIF')
>>>print im.format, im.size, im.mode
>>> TIFF (6000, 6000) I;16S
>>>dem = fromstring(im.tostring(),'int16')
> ValueError: unrecognised mode
> The problem must be because of mode of my data (I;16S) and I don't know how
> to read it.
> I really appreciate any help with this.
> Many Thanks
> Image-SIG maillist - Image-SIG at python.org
More information about the Image-SIG