[reportlab-users] Image-Compression: drawImage() using PIL -> PDF very large
Patrick Ulmer
reportlab-users@reportlab.com
Thu, 18 Mar 2004 12:04:57 +0100
Hi,
I have a size-problem with my pdf-file. I use reportlab 1.18 becaus of
PIL. When I include a jpeg-file with drawImage(), the pdf-size is good,
because the compressed image is inserted as it is. When I insert a
PIL-jpeg-image, the rawdata compressed using zlib is inserted and the
pdf-size is extrem larger. This is my source:
# load data from zope
logo = getattr(self.REQUEST.PARENTS[0].images.formulare, "headline.jpg")
img = PIL_Image.open(cStringIO.StringIO(str(logo.data)))
# draw image
c.drawImage(img, 0, 0)
How can I solve this Problem?
1.) hack pdfimages.py?
2.) save img as tempfile and use c.drawImage(tmp, 0, 0)?
3.) somethind else?
Thanks,
Patrick