Hmmm.. how about getting a sub_region before making a call to
#get_image_data().

subimage = pic.get_region(x, y, width, height)



On Tue, Aug 19, 2014 at 2:26 PM, Raymond Liu <[email protected]> wrote:

> Suppose I have an image, obtained by
>
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/pyglet-users.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Incoherently,
Ricky Ng

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to