Problems reading tif files

gujax rjngrj2010 at gmail.com
Sun Sep 26 20:31:47 EDT 2010


Hi,
I have read several related e-mails dating back as far as 2006. I am
quite confused whether PIL can open tif images. Some posts seem to say
there isn't yet any support for PIL while there are few posts where
PIL has been able to open tif images. So I guess, I have to ask this
probably trivial question again. I am just learning python and PIL. I
have tiff images which are 8 bit and 16 bit gray scale images. I
cannot open them. Here are the errors that I encounter.

>> Image.open('filename')
 >> im.info

(640, 480)
{'resolution': (1, 1), 'compression': 'raw'}
F;32BF
TIFF


But when I run the im.show() it gives the following error.
>>> im.show()
Traceback (most recent call last):
 File "<pyshell#0>", line 1, in <module>
   im.show()
 File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 1483, in
show
   _show(self, title=title, command=command)
 File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 2123, in
_show
   apply(_showxv, (image,), options)
 File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 2127, in
_showxv
   apply(ImageShow.show, (image, title), options)
 File "/usr/lib/python2.6/dist-packages/PIL/ImageShow.py", line 41, in
show
   if viewer.show(image, title=title, **options):
 File "/usr/lib/python2.6/dist-packages/PIL/ImageShow.py", line 62, in
show
   base = Image.getmodebase(image.mode)
 File "/usr/lib/python2.6/dist-packages/PIL/Image.py", line 245, in
getmodebase
   return ImageMode.getmode(mode).basemode
 File "/usr/lib/python2.6/dist-packages/PIL/ImageMode.py", line 50, in
getmode
   return _modes[mode]
KeyError: 'F;32BF'

I have no idea why this happens.
I will appreciate a resolution. The file opens with ImageJ and
ImageMagick. It is a 8-bit RGB file. I have associated default viewer
to be ImageMagick. I am on Lucid Linux, and other programs such as F-
spot and Gimp cannot open those files either.
I don't yet know how to attach image files to the post so please bear
with me till I figure that out.

Thanks,
gujax



More information about the Python-list mailing list