[reportlab-users] RenderPM + clipping + drawImage

khalid y kernity at gmail.com
Mon Apr 18 09:24:30 EDT 2011

Hi guys,

I'm looking to render a png with a clipped image but it seems that when I
add an image is not clipped.
It's working with others shapes types but not with Image...

Here is my code :

from reportlab.lib import colors
from reportlab.pdfgen import canvas
from reportlab.graphics import shapes, renderPM

d = shapes.Drawing(500, 500)
path = shapes.Path()
path.moveTo(100, 100)
path.lineTo(100, 150)
path.lineTo(150, 150)
path.lineTo(150, 100)

path.isClipPath = True

image = shapes.Image(50, 50, 200, 200, './img.png')

// if here I add d.add(shapes.Rect(....)) it's working

img = renderPM.drawToPIL(d)
img.save("output.png", "png")

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20110418/7878c21b/attachment.html>

More information about the reportlab-users mailing list