[Image-SIG] Does PIL not handle TIFFs created on Mac OS X?

Rob Managan managan at llnl.gov
Wed Sep 17 12:32:08 EDT 2003


At 12:31 PM +0200 9/17/03, Dinu Gherman wrote:
>Hi,
>
>has anybody succeeded here in using PIL for loading TIFFs generated
>on OS X, e.g. stuff like the attached little sample file? I'm using
>PIL 1.1.4, but get errors like the following:
>
>   >>> import Image
>   >>> tiff = Image.open("test.tiff")
>   Traceback (most recent call last):
>     File "<stdin>", line 1, in ?
>     File "/usr/lib/python2.2/site-packages/PIL/Image.py", line 1571, in open
>       raise IOError("cannot identify image file")
>   IOError: cannot identify image file
>
If you add the line
Image.DEBUG = 1 after the import you get this information
tag: ImageWidth (256) - type: short (3) - value: (55,)
tag: ImageLength (257) - type: short (3) - value: (43,)
tag: BitsPerSample (258) - type: short (3) - value: (8, 8, 8, 8)
tag: Compression (259) - type: short (3) - value: (1,)
tag: PhotometricInterpretation (262) - type: short (3) - value: (2,)
tag: StripOffsets (273) - type: long (4) - value: (8,)
tag: SamplesPerPixel (277) - type: short (3) - value: (4,)
tag: StripByteCounts (279) - type: long (4) - value: (9460,)
tag: XResolution (282) - type: rational (5) - value: ((720000, 10000),)
tag: YResolution (283) - type: rational (5) - value: ((720000, 10000),)
tag: PlanarConfiguration (284) - type: short (3) - value: (1,)
tag: ResolutionUnit (296) - type: short (3) - value: (2,)
tag: ExtraSamples (338) - type: short (3) - value: (1,)
*** Summary ***
- compression: raw
- photometric_interpretation: 2
- planar_configuration: 1
- size: (55, 43)
format key: (2, 1, (8, 8, 8, 8), (1,))
- unsupported format
tag: ImageWidth (256) - type: short (3) - value: (55,)
tag: ImageLength (257) - type: short (3) - value: (43,)
tag: BitsPerSample (258) - type: short (3) - value: (8, 8, 8, 8)
tag: Compression (259) - type: short (3) - value: (1,)
tag: PhotometricInterpretation (262) - type: short (3) - value: (2,)
tag: StripOffsets (273) - type: long (4) - value: (8,)
tag: SamplesPerPixel (277) - type: short (3) - value: (4,)
tag: StripByteCounts (279) - type: long (4) - value: (9460,)
tag: XResolution (282) - type: rational (5) - value: ((720000, 10000),)
tag: YResolution (283) - type: rational (5) - value: ((720000, 10000),)
tag: PlanarConfiguration (284) - type: short (3) - value: (1,)
tag: ResolutionUnit (296) - type: short (3) - value: (2,)
tag: ExtraSamples (338) - type: short (3) - value: (1,)
*** Summary ***
- compression: raw
- photometric_interpretation: 2
- planar_configuration: 1
- size: (55, 43)
format key: (2, 1, (8, 8, 8, 8), (1,))
- unsupported format

In the IDE I found that the problem originates in 
PIL/TiffImagePlugin.py line 510

The closest format keys are
(2, 1, (8, 8, 8, 8), (0,)) ('RGBX','(RGBX)')
(2, 1, (8, 8, 8, 8), (2,)) ('RGBA','(RGBA)')

I tired adding (2, 1, (8, 8, 8, 8), (1,)) ('RGBX','(RGBX)')
but I haven't succeeded in getting the change to be used yet. Must be 
doing it in the wrong place.
-- 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Rob Managan               email managan at llnl.gov
LLNL                      phone: 925-423-0903
P.O. Box 808, L-095       FAX:   925-422-3389
Livermore, CA  94551-0808




More information about the Image-SIG mailing list