[reportlab-users] What's wrong with this ?

Ian Sparks reportlab-users@reportlab.com
Mon, 23 Feb 2004 12:02:44 -0500

Does PIL correctly handle all PNGs?

I see this from October 2003:


Try this with a bitmap or jpeg and see if you have the same problem =
(just as a test to see where the problem lies).=20

-----Original Message-----
From: philippe shrom [mailto:shrom@admin.zzn.com]
Sent: Monday, February 23, 2004 11:51 AM
To: reportlab-users@reportlab.com
Subject: [reportlab-users] What's wrong with this ?

Hi everebody,

I'm trying to include an image in a canva with drawImage like it is
specified in docs: "The image parameter may be either a
PIL Image object or an image filename."

here is the code:
 from reportlab.pdfgen import canvas
import Image

c =3D canvas.Canvas( "imagetest.pdf" )
img =3D Image.open('pict/logo.png')
c.drawImage(img, 150, 150 )

Here is the error:
Traceback (most recent call last):
  File "drawlogo.py", line 10, in ?
    c.drawImage(img, 150, 150 )

vas.py", line 586, in drawImage
    rawdata =3D image.getRGBData()
AttributeError: PngImageFile instance has no attribute 'getRGBData'

I looked at the source code of canvas.py and it is said:
"Draws the image (ImageReader object or filename) as specified"

Do I have to provide an ImageReader object or a PIL image object ?

Python 2.3.2
PIL 1.1.4
Windows 2000

Get your Free E-mail at http://admin.zzn.com
Get your own Web-based E-mail Service at http://www.zzn.com
reportlab-users mailing list