Otherwise the image object may not have the data, and data.split()
fails with
AttributeError: 'NoneType' object has no attribute 'bands'
---
My PIL is at 1.1.7, python is 2.7.
The error log leading up to that is
File "/home/mjg/src/pyx/pyx/epsfile.py", line 354, in processPDF
b.processPDF(file, writer, context, registry, bbox)
File "/home/mjg/src/pyx/pyx/bitmap.py", line 515, in processPDF
mode, data, alpha, palettemode, palettedata = self.imagedata(False)
File "/home/mjg/src/pyx/pyx/bitmap.py", line 361, in imagedata
bands = data.split()
File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 1497, in split
if self.im.bands == 1:
AttributeError: 'NoneType' object has no attribute 'bands'
In fact, the same problem occurs when inserting PIL images with lazy loading.
One may or may not leave the Image.load() invocation at the user's discretion
in that case. One may actually claim that it's a matter of PIL being too lazy...
---
pyx/epsfile.py | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/pyx/epsfile.py b/pyx/epsfile.py
index 72a9406..6f1b8be 100644
--- a/pyx/epsfile.py
+++ b/pyx/epsfile.py
@@ -345,6 +345,7 @@ class epsfile(canvasitem.canvasitem):
f.close()
c.pipeGS(fname, device="pngalpha", resolution=600)
i = Image.open(fname)
+ i.load()
os.unlink(fname)
b = bitmap.bitmap_pt(self.bbox().llx_pt, self.bbox().lly_pt, i)
# we slightly shift the bitmap to re-center it, as the bitmap might
contain some additional border
--
1.7.5.1.445.gf3e03
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
PyX-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-devel