[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Lossless Graphic File Formats



Peter Shinners wrote:

On Mon, 2006-04-24 at 07:34 -0400, Kris Schnee wrote:


By the way, I'm wondering about saving images in a lossless way, preserving the exact color values of each pixel. Looks like the BMP format does that, but JPG and TGA don't, and while PNG apparently does, it's not supported in Pygame unless maybe I install PIL and some additional module.



The TGA and BMP formats are all that get included with Pygame. Both of these save uncompressed raw images, so they are lossless. I believe the TGA supports a few extra pixel formats, while the BMP is only 24bit data.

Something like PNG would be nicer because it does the lossless
compression. But you will need the help of an outside library for that.



Most people use Python Imaging Library for that:

http://www.pythonware.com/products/pil/

There are other packages out there, but this is probably the
easiest, and one of the faster ones. It's well documented, and
pretty up to date.

Cheers,
Terry

--
Terry Hancock (hancock@xxxxxxxxxxxxxxxxxxxx)
Anansi Spaceworks http://www.AnansiSpaceworks.com