Memory-efficient way of getting a single pixel colour value from an image?
2014-08-19 19:26:02 GMT
img = pyglet.image.load("dog.jpg")
I know I can access the image data by using, for example,
data = img.get_image_data().get_data("RGB", img.width*3)
But the problems is that the object `data` obtained as above is very very big, since it contains the RBG value of each pixel a potentially large image. For a 1024 by 768 image, the size of `data` is well over 2GB. That feels like it's a lot to keep in memory, even if temporarily. All I need for my program is to access the RGB value of one particular pixel of my choosing. Is there a memory-efficient way of doing that in Pyglet? In PyGame for example, there is `pygame.Surface.get_at()`. Is there a similar thing in Pyglet?
You received this message because you are subscribed to the Google Groups "pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscribe <at> googlegroups.com.
To post to this group, send email to pyglet-users <at> googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.