Hello Matthias and the release team, On Mon, 11 May 2015, Claude Paroz wrote: > Reportlab crashes when getting the transparency of some PNG images during > PDF rendering. > This is apparently a known problem and it has been fixed upstream: > https://bitbucket.org/rptlab/reportlab/commits/7df61e325601580bc36db042c6d6a8a776f62eef
I would like to see this bug fixed in jessie because it's a regression compared to wheezy. Dear release team, assuming that I get this bug fixed in unstable first. Would you accept a stable upload containing only the attached upstream patch? Matthias, can you take care of getting this patch applied in unstable or would you accept an NMU from me to add this patch? Thank you for your feedback! -- Raphaël Hertzog ◈ Debian Developer Support Debian LTS: http://www.freexian.com/services/debian-lts.html Learn to master Debian: http://debian-handbook.info/get/
# HG changeset patch # User robin # Date 1398687918 -3600 # Node ID 7df61e325601580bc36db042c6d6a8a776f62eef # Parent b07c2c8b02de8a60984b00766f8d6bf77ca72266 utils.py: ImageReader handle png indexed with transparency specially diff --git a/src/reportlab/lib/utils.py b/src/reportlab/lib/utils.py --- a/src/reportlab/lib/utils.py +++ b/src/reportlab/lib/utils.py @@ -823,7 +823,12 @@ im = im.convert('RGB') self.mode = 'RGB' elif mode not in ('L','RGB','CMYK'): - im = im.convert('RGB') + if im.format=='PNG' and im.mode=='P' and 'transparency' in im.info: + im = im.convert('RGBA') + self._dataA = ImageReader(im.split()[3]) + im = im.convert('RGB') + else: + im = im.convert('RGB') self.mode = 'RGB' if hasattr(im, 'tobytes'): #make pillow and PIL both happy, for now self._data = im.tobytes() diff --git a/tests/test_pdfgen_general.py b/tests/test_pdfgen_general.py --- a/tests/test_pdfgen_general.py +++ b/tests/test_pdfgen_general.py @@ -715,6 +715,8 @@ if haveImages: c.drawImage(gif, 1*inch, 1.2*inch, w, h, mask=myMask) c.drawImage(gif, 3*inch, 1.2*inch, w, h, mask='auto') + c.drawImage(os.path.join(testsFolder,'test-rgba.png'),5*inch,1.2*inch,width=10,height=10,mask='auto') + c.drawImage(os.path.join(testsFolder,'test-indexed.png'),5.5*inch,1.2*inch,width=10,height=10,mask='auto') else: c.rect(1*inch, 1.2*inch, w, h) c.rect(3*inch, 1.2*inch, w, h)