try this one (inspired by the original PILImageEncoder):
pyglet.image.get_buffer_manager().get_color_buffer().save('screenshot.bmp',
encoder=PILImageEncoder())
class PILImageEncoder(pyglet.image.codecs.ImageEncoder):
def encode(self, image, file, filename):
import Image
image = image.get_image_data()
format = image.format
pitch = -(image.width * len(format))
pil_image = Image.fromstring(
format, (image.width, image.height),
image.get_data(format, pitch))
try:
pil_image.convert("RGB").save(file)
except Exception, e:
raise ImageEncodeException(e)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---