[Image-SIG] Reading 16bit image
Michael Volkmer
volkmer@mpi-cbg.de
Fri, 09 Aug 2002 11:36:11 +0200
I use PIL 1.1.3 to read uncompressed 16 bit TIFF images. LZW compressed
tiffs doesn't work for me.
PIL uses the "I,16" mode in the default Image.open(). I addition I added
the following line to the TiffImagePlugin.py OPEN_INFO :
(1, 1, (16,), ()): ("I;16", "I;16")
I'm not shure if this is really needed.
Most of the PIL functions doesn't seem to work in this mode so I
converted the Image to 32bit with
im = Image.open(<file>).convert("I") in order to access the image data
with putpixel()/getpixel() at least.
M. Volkmer
Am 08/06/2002 11:03 AM, Aureli Soria Frisch schrieb:
>
>> how can I use the "raw decoder" to read a binary 16 bit image?
>> I tried doing this:
>>
>>>> import Image
>>>> data = open('binary_file').read() #string buffer with data
>>>> size = (256 256) #this is really its size
>>>> mode = 'F;16'
>>>> image = Image.fromstrin(mode,size,data,"raw")
>>>
>>
>> Python tells me this mode (F;16) does not exist. So, wich mode must I
>> use for
>> 16 bit images?
>> Could somebody help me?
>
>
> I submitted a while ago a question related to the possibility of
> opening TIF files with 16 bit depth that remained with no answer...
>
> It would be interesting to know how to work with 16 bit files in PIL
> in general (it does not seem to be possible with the open source
> version of PIL)...
>
> Thanks,
> Aureli