To answer your actual question, when textures are scaled it happens inside the GPU at runtime (With filtering). There is no scale-then-blit procedure. You have to render to texture then read the pixels back off of the gpu (an expensive round trip if all you want to do is scale a 2d sprite). Like Juan said, use a library intended for the job like PIL (Or pillow if you want a library not dead with python 3 support)
On Fri, Apr 18, 2014 at 4:17 AM, "Juan J. MartÃnez" <[email protected]> wrote: > On 18/04/14 09:13, Gerald Thibault wrote: >> [...] >> This correctly scales the image to 48x64 and draws it to the window. How >> do I get the raw pixel data that was drawn to the window? I've been >> googling this for hours and have been unable to find a solution. I'm not >> even interested in drawing to the window, or using the sprite class at >> all, but I was unable to find any examples at all of how to upscale an >> image with independent scale values for x and y. This is the closest >> I've been able to get to an expected end result, but I can only get it >> in the window, I have no idea how to get those pixel values. Did I miss >> something glaringly obvious in the docs? All I want to do is scale an >> image and get the pixel data, I don't want to draw anything to the >> window (or have any window at all). > > Do you need pyglet at all? Why don't you use PIL* directly? > > - > http://pillow.readthedocs.org/en/latest/reference/Image.html#PIL.Image.Image.resize > - > http://pillow.readthedocs.org/en/latest/reference/Image.html#PIL.Image.Image.getdata > > Regards, > > Juan > > * Pillow instead > > -- > jjm's home: http://www.usebox.net/jjm/ > blackshell: http://blackshell.usebox.net/ > > -- > 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. -- 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.
