Python Forum

Full Version: making graphical image files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
are there modules for making graphical image files in formats like BMP. GIF, JPEG, and PNG? i would be surprised if there are none. but the question i have is how Python programs are expected to hold images before outputting them to files via one of these image formatting modules. and if the Python script is actually constructing the image, is the image intermediate and final result stored the same way as stored when reading the image from a file like BMP. GIF, JPEG, and PNG? IOW, how do you expect to store a pixel, a row of pixels, and/or a 2-D image of pixels?
PIL (or the better pillow fork of it) and pygame have methods for creating images. I never created an image from scratch, but i have modified an existing image. Actually in pygame you do it all the time to set a colorkey to alpha. You just normally dont save it as a new image.

Pixels are just a shade of color usually RGB. (red, green, blue) for a max of (255,255,255) each pixel. So basically a list of these tuples in a certain order make up an image.
so it's stored as tuples, not as bytes. probably better to work with it that way.