[Image-SIG] IOError: decoder group3 not available

David Thibault dthibault@esperion.com
Mon, 21 Apr 2003 13:36:34 -0400

If I try to import the TIFF image directly to PDF I get the following error:
Traceback (most recent call last):
  File "./tiff2pdf.py", line 8, in ?
  File "/usr/local/zope/lib/python2.1/reportlab/pdfgen/canvas.py", line 513,
in drawImage
    rawdata = image.convert('RGB').tostring()
  File "/usr/local/zope/lib/python2.1/PIL/Image.py", line 427, in convert
  File "/usr/local/zope/lib/python2.1/PIL/ImageFile.py", line 140, in load
    d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "/usr/local/zope/lib/python2.1/PIL/Image.py", line 243, in
    raise IOError, "decoder %s not available" % decoder_name
IOError: decoder tiff_ccitt not available
Note that now it's complaining about a different decoder not being

Here's the code that causes this problem:
from reportlab.pdfgen import canvas
from PIL import Image

im = Image.open('multipage2.tif')

c = canvas.Canvas('test.pdf')


-----Original Message-----
From: D. Alan Stewart [mailto:astewart@layton-graphics.com] 
Sent: Monday, April 21, 2003 1:12 PM
To: David Thibault
Cc: image-sig@python.org
Subject: Re: [Image-SIG] IOError: decoder group3 not available

 From what you've said it sounds like your TIFF has 1-bit per pixel 
images compressed, Group 3/4 compressed. You would need to  decompress 
 eash image, convert it to  8-bit per pixel grayscale (which will be 8 
times the size of the original uncompressed image; RGB would be 24 times 
the original size), and then JPG compress it. I doubt this will produce 
a  compressed  image smaller than the Group 3 image you have now. The 
PDF specification supports Group 3 image compression, why not just 
transfer the compressed image as is to the PDF and not hassle with all 
this? See section 3.3.5 of the 1.4 PDF Specification for a description 
of the CCITTFaxDecode filter....

David Thibault wrote:

>Hello all,
>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.  I
>was hoping to take each tiff, pull out each page, convert it to jpg, then
>add it to the PDF file so that it would minimize the size of the files.
>However, anything that will work programmatically will make me happy...
>Image-SIG maillist  -  Image-SIG@python.org


D. Alan Stewart
Senior Software Developer
Layton Graphics, Inc.
Marietta, GA U.S.A.