src/reportlab/lib/utils.py
changeset 3695 1b0c70ee944f
parent 3687 1fead6079288
child 3769 51bcf79be4df
--- a/src/reportlab/lib/utils.py	Tue May 21 11:17:03 2013 +0100
+++ b/src/reportlab/lib/utils.py	Thu May 30 11:08:55 2013 +0100
@@ -650,7 +650,10 @@
                     elif mode not in ('L','RGB','CMYK'):
                         im = im.convert('RGB')
                         self.mode = 'RGB'
-                    self._data = im.tostring()
+                    if hasattr(im, 'tobytes'):  #make pillow and PIL both happy, for now
+                        self._data = im.tobytes()
+                    else:
+                        self._data = im.tostring()
             return self._data
         except:
             annotateException('\nidentity=%s'%self.identity())