Description: ImageReader handle png indexed with transparency specially
Bug-Debian: https://bugs.debian.org/785023
Origin: upstream, https://bitbucket.org/rptlab/reportlab/commits/7df61e325601580bc36db042c6d6a8a776f62eef

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)
