[Image-SIG] Re: IOError: decoder group3 not available

David Thibault dthibault@esperion.com
Tue, 22 Apr 2003 10:22:01 -0400


Thanks, I'll try that!
Dave

-----Original Message-----
From: Fredrik Lundh [mailto:fredrik@pythonware.com] 
Sent: Tuesday, April 22, 2003 10:06 AM
To: image-sig@python.org
Subject: [Image-SIG] Re: IOError: decoder group3 not available

David Thibault wrote:

> I've got multipage TIFF files that I need to convert to PDF using PIL and
> reportlab.  I think I'd be all set except I seem to be hitting an old bug.
> I saw this:
> http://mail.python.org/pipermail/image-sig/2002-February/001736.html and
it
> seems to be the exact problem I'm running into.  Has anyone ever figured
> this out?  These tiff's are mode 1 and I get the exact error in the
subject
> line if I try to convert them to RGB or if I try to convert them to JPG.

PIL's TIFF reader identifies various CCITT encodings, but PIL doesn't
include codecs for this format.  This means that you can open the file,
but you cannot read the pixels from it.

I suggest using the "tiffcp" utility shipped with libtiff (www.libtiff.org)
to "decompress" the file before reading it with PIL:

    def tiffopen(filename):
        os.system("tiffcp -c none %s temp.tif" % filename)
        im = Image.open("temp.tif")
        os.remove("temp.tif") # on windows, you have to load the data first
        return im

    im = tiffopen("myfile.tif")

    for frame in ImageSequence.Iterator(im):
        ...

</F>




_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig