Image.read_pixel is broken in at least two ways. I was able to fix one of them,
but no idea what
the cause of the remaining problem is...
Consider this patch:
diff --git a/pymt/core/image/__init__.py b/pymt/core/image/__init__.py
index 25e007d..524d6f6 100644
--- a/pymt/core/image/__init__.py
+++ b/pymt/core/image/__init__.py
@@ -221,10 +221,11 @@ class Image(pymt.BaseObject):
data = self.image._data
if not (0 < x < data.width and 0 < y < data.height):
raise IndexError('Position (%d, %d) is out of range.' % (x, y))
- assert mode in ImageData._supported_modes
+ assert data.mode in ImageData._supported_modes
size = 3 if data.mode in ('RGB', 'BGR') else 4
# FIXME BGR cases
index = y * data.width * size + x * size
+ # FIXME dennda: Why is data.data == None??
raw = data.data[index:index+size]
color = map(lambda c: ord(c)/255.0, raw)
return color
The first problem is that the global name mode is not defined, easy fix, just
use data.mode. That
is broken since
http://github.com/tito/pymt/commit/bf646f40dddc4f7cecda45a7af26e8f33c465f89
Why data.data is None there, I don't know. No idea what changed in the
underlying code, but
should be easy to fix.
What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by dennd...@gmail.com on 27 Dec 2009 at 4:58
Original issue reported on code.google.com by
dennd...@gmail.com
on 27 Dec 2009 at 4:58