[reportlab-users] bug with image transparency?!

Volker Haas volker.haas at brainbot.com
Mon Oct 20 08:47:06 EDT 2008


Hi,

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.

This is what PIL tells me about the image:

In [1]: from PIL import Image
In [2]: img = Image.open('MergeSampleStep1.png')
In [3]: img.mode
Out[3]: 'P'
In [4]: img.info
Out[4]:
{'Software': 'Paint.NET v3.35',
'gamma': 0.45455000000000001,
'transparency': 255}


Sample code:


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)

--
volker haas brainbot technologies ag
fon +49 6131 2116394 boppstraße 64
fax +49 6131 2116392 55118 mainz
volker.haas at brainbot.com http://www.brainbot.com/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: MergeSampleStep1.png
Type: image/png
Size: 14540 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20081020/92f83dee/attachment.png>


More information about the reportlab-users mailing list