[reportlab-users] bug with image transparency?!

Tim Roberts timr at probo.com
Mon Oct 20 13:27:14 EDT 2008

Volker Haas wrote:


> I guess I just ran into an image which is not rendered correctly using

> reportlab (version 2.1).

> All black pixels are rendered white (or transparent on a white

> background).

> The image displays correctly in a browser or image viewer.

> ...

> from reportlab.platypus import BaseDocTemplate, PageTemplate, Frame,

> Image

> from reportlab.rl_config import defaultPageSize


> doc = BaseDocTemplate("test.pdf")


> frame = Frame(0,0,defaultPageSize[0], defaultPageSize[1])

> doc.addPageTemplates(PageTemplate(frames=frame))


> Story = [Image("MergeSampleStep1.png")]

> doc.build(Story)

Very interesting; I think there is some confusion in the code between
Platypus and canvas about what the "mask" parameter means. In the short
term, you can work around this by saying:

Story = [Image("MergeSampleStep1.png", mask=None)]

At least, that fixed your sample for me.

Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

More information about the reportlab-users mailing list