Raymond Liu wrote:
What `get_data()` does is that it effectively turns the jpeg into a massive bitmap, and I don't want to store a massive bitmap in RAM every time I want to access the colour of just one pixel
A bit of googling suggests that there are ways to decompress just part of a jpeg, but it's unlikely that pyglet will have anything built in to do that. Can you tell us more about your use case? Do you have just one or a few jpegs that you repeatedly sample, or will it be a different jpeg each time? If it's just a few, I'd suggest storing them on disk in a format that's more amenable to random access. > I'm using
`get_image_data().get_data()` to get the colour of that single pixel. As far as I can see, this method avoids converting the whole jpeg into a huge bitmap. At least according to `sys.getsizeof()`
I wouldn't trust sys.getsizeof() on that. It's probably just reporting the size of a header object that contains pointers to the actual data. Most likely, it's decompressing the whole image and then giving you a view of part of it. -- Greg -- 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.
