[Image-SIG] modes in Image package
Bob Klimek
klimek at grc.nasa.gov
Thu Aug 25 19:58:07 CEST 2005
Fredrik Lundh wrote:
>Victor Reijs wrote:
>
>
>
>>I was wondering if it is possible with the Image package to use a mode
>>like RGB but with 16 bits (or more) per each band?
>>
>>
>
>there's no built-in Nx16-bit type, but you can of course use multiple
>single layer images, and split/merge on the way in/out.
>
>
>
Fredrik, hmmm, I didn't think that was possible. Do I understand
correctly? Are you saying that if I have a 16-bit/plane RGB image (tif),
there is some way to read it into PIL by splitting it on the way in? It
that's the case, that would be wonderful! Can you show a code sample how
this can be done?
Below is my unsuccessful attempt and the resulting traceback. In this
case "bear.tif" is a 48-bit RGB image. So what am I missing?
>>> import Image
>>> r,g,b = Image.open("h:/bear.tif").split()
Traceback (most recent call last):
File "<pyshell#2>", line 1, in -toplevel-
r,g,b = Image.open("h:/bear.tif").split()
File "H:\Python24\Lib\site-packages\PIL\Image.py", line 1745, in open
raise IOError("cannot identify image file")
IOError: cannot identify image file
>>>
Regards,
Bob
More information about the Image-SIG
mailing list