My favorites | Sign in
Project Home Downloads Issues
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 146: Image.read_pixel is broken
1 person starred this issue and may be notified of changes. Back to list
Status:  Done
Owner:  txprog
Closed:  Dec 2009


 
Project Member Reported by dennd...@gmail.com, Dec 27, 2009
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.

Dec 27, 2009
Project Member #1 txprog
(No comment was entered for this change.)
Status: Done
Owner: txprog
Labels: Milestone-0.4 Component-Core

Powered by Google Project Hosting