Saving Images

An image can be saved from Python using PIL's new(), fromstring(), and save() functions.

str = glReadPixels(0, 0, width, height,
                   GL_RGB, GL_UNSIGNED_BYTE)
img = Image.new('RGB', (width, height))
img.fromstring(str)
img.save("image.jpg")

Example: saveImage.py


next