[SciPy-dev] pilutils bug
John Byrnes
byrnes at bu.edu
Thu Nov 10 20:38:32 EST 2005
Hello all,
I've discovered a bug in the pilutils fromimage function.
On line 93 of Lib/utils/pilutil.py, arr.shape expects a tuple, apparently
it is not recieving one. I fixed it by casting the new shape to a tuple. I'm
sure there is a better way of fixing it, but this is what worked for me.
Patch is attached.
Best regards,
John Byrnes
-------------- next part --------------
Index: Lib/utils/pilutil.py
===================================================================
--- Lib/utils/pilutil.py (revision 1431)
+++ Lib/utils/pilutil.py (working copy)
@@ -78,7 +78,7 @@
shape = list(im.size)
shape.reverse()
if mode == 'P':
- arr.shape = shape
+ arr.shape = tuple(shape)
if im.palette.rawmode != 'RGB':
print "Warning: Image has invalid palette."
return arr
@@ -90,7 +90,7 @@
shape += [3]
elif mode in ['CMYK','RGBA']:
shape += [4]
- arr.shape = shape
+ arr.shape = tuple(shape)
if adjust:
arr = (arr != 0)
return arr
More information about the SciPy-Dev
mailing list