[reportlab-users] PNG problem

Lionel Roubeyrie lroubeyrie at limair.asso.fr
Wed Mar 23 10:30:16 EST 2005


Hi all,
I try to put an image in a pdf document, but for the first try with a eps 
image, the result seem bad, the characters are badly retranscribed (fatty, 
fuzzy), and if I try with a png image (previously opened with PIL), I get a :
usr/lib/python2.3/site-packages/reportlab/pdfgen/canvas.py in drawImage(self, 
image, x, y, width, height, mask)
    584             name = _digester('%s%s' % (image, mask))
    585         else:
--> 586             rawdata = image.getRGBData()
    587             name = _digester(rawdata)
    588
AttributeError: Image instance has no attribute 'getRGBData'

Here the source code (running on a Debian Sarge, reportlab 1.20 and PIL1.1.4):
import Image
from reportlab.pdfgen import canvas
from reportlab.lib import pagesizes, colors
# from reportlab.lib.colors import green, orange, red, black

img=Image.open('fond_coul.png')
x, y = img.size
img=img.resize(size=(x/4, y/4), resample=1)
img=img.convert(mode='RGB')
c=canvas.Canvas("test.pdf", pagesize=pagesizes.A4)
c.drawImage(img,0,0)
c.showPage()
c.save()

thanks for your help

-- 
Lionel Roubeyrie - lroubeyrie at limair.asso.fr
LIMAIR
http://www.limair.asso.fr



More information about the reportlab-users mailing list