Problems reading tif files


G

gujax

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.

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


But when I run the im.show() it gives the following error.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
 
Ad

Advertisements

G

gujax

Am 27.09.2010 02:31, schrieb gujax:
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.

PIL only supports a limited subset of TIFF files. Several compression
algorithms like G3 and G4 fax compression are not supported yet. PIL may
have a problem with partly broken TIFF files, too.
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.

Can you please post the output of tiffinfo for the specific file? It may
give me a hint what's going wrong.

There aren't a lot of good alternatives for image processing in Python.
I've evaluated most of them and decided to write my own one for my
employer. It's a Cython based library around FreeImage [1] and LCMS2 [2]
and works very well. So far we have processed several million TIFF files
with more than 100 TB of raw data smoothly. I've permission to release
the software as open source but haven't found time to do a proper release..

Christian Heimes

[1]http://freeimage.sourceforge.net/
[2]http://www.littlecms.com/

Thanks Christian,
Here is the tiffinfo:

TIFF Directory at offset 0x8 (8)
Subfile Type: (0 = 0x0)
Image Width: 640 Image Length: 480
Bits/Sample: 32
Sample Format: IEEE floating point
Compression Scheme: None
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Rows/Strip: 480
Planar Configuration: single image plane
ImageDescription: ImageJ=1.44f
min=0.0
max=255.0

How do I use freeimage with python. Is there a backend?
Can these files be converted to something else such as bmp and then
read out? I should have tried it out before asking you,
Thanks
 
Ad

Advertisements

G

gujax

Thanks Christian,
Here is the info:
TIFF Directory at offset 0x8 (8)
Subfile Type: (0 = 0x0)
Image Width: 640 Image Length: 480
Bits/Sample: 32
Sample Format: IEEE floating point
Compression Scheme: None
Photometric Interpretation: min-is-black
Samples/Pixel: 1
Rows/Strip: 480
Planar Configuration: single image plane
ImageDescription: ImageJ=1.44f
min=0.0
max=255.0

How can I use freeimage. Can I incorporate it with python? Any idea
what do ImageJ or Matlab use. Don't they have a robust imaging
toolbox. Unfortunately, I cannot afford Matlab and I am not good at
Java programing to be able to implement ImageJ with numerical analysis
software.

Thanks much,
gujax



Am 27.09.2010 02:31, schrieb gujax:
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.

PIL only supports a limited subset of TIFF files. Several compression
algorithms like G3 and G4 fax compression are not supported yet. PIL may
have a problem with partly broken TIFF files, too.
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.


Can you please post the output of tiffinfo for the specific file? It may
give me a hint what's going wrong.

There aren't a lot of good alternatives for image processing in Python.
I've evaluated most of them and decided to write my own one for my
employer. It's a Cython based library around FreeImage [1] and LCMS2 [2]
and works very well. So far we have processed several million TIFF files
with more than 100 TB of raw data smoothly. I've permission to release
the software as open source but haven't found time to do a proper release..

Christian Heimes

[1]http://freeimage.sourceforge.net/
[2]http://www.littlecms.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top