[reportlab-users] painting an image over another
Andy Robinson
andy at reportlab.com
Fri Feb 4 02:50:43 EST 2005
>From reortlab/pdfgen/canvas:
def drawImage(self, image, x, y, width=None, height=None, mask=None):
"""Draws the image (ImageReader object or filename) as specified.
"image" may be an image filename or a ImageReader object. If width
and height are not given, the "natural" width and height in pixels
is used at a scale of 1 point to 1 pixel.
The mask parameter takes 6 numbers and defines the range of
RGB values which will be masked out or treated as transparent.
For example with [0,2,40,42,136,139], it will mask out any
pixels with a Red value from 0-2, Green from 40-42 and
Blue from 136-139 (on a scale of 0-255)
Look at reportlab/test/test_pdfgen_general.py
and the output test_pdfgen_general.pdf (which it rather
cryptically puts under your temp directory, not alongside). There
is one example of an image mask there.
However, I have not used it for overlaying images and
am not 100% sure it works the way you want; please let us know!
thanks,
Andy Robinson
More information about the reportlab-users
mailing list