[Pythonmac-SIG] Does PIL handle OS X TIFFs?
Bob Ippolito
bob at redivi.com
Tue Sep 16 20:37:37 EDT 2003
On Tuesday, Sep 16, 2003, at 19:32 America/New_York, Dinu Gherman wrote:
> Hi,
>
> has anybody succeeded here in using PIL for loading TIFFs generated
> on OS X, e.g. stuff created like this?
>
> img = NSImage...
> tiffData = img.TIFFRepresentation()
> tiffData.writeToFile_atomically_(path, YES)
>
> 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
PIL doesn't support that level of TIFF.. the TIFF files that OS X
produces have a signature of 'MM\x00*', which is not supported by
TiffImagePlugin (PIL can't even save big endian TIFFs). You're better
off using ObjC for getting the pixels anyways (faster, more complete,
etc).
Python could use a PIL replacement that's a lot smarter (better at bit
swizzling, can interface to native APIs like QuickTime, etc.).
-bob
More information about the Pythonmac-SIG
mailing list