IMG_SavePNG does not preserve the image format |
Mason Wheeler
Guest
|
I've got a utility that opens an 8-bit PNG file, slices it up into several smaller files, and saves them for later use. When they're used later, the files are loaded and read into an SDL_Surface, and the code locates palette index 0, if it can, to set as a color key before loading them to textures. Unfortunately, I just discovered that I've got no color key because I've got no palette, because IMG_SavePNG is saving them as a 32-bit image rather than an 8-bit image! I looked at the source, and sure enough, it checks to make sure that the image is a 32-bit RGBA image, or forcibly converts it before saving if it isn't.
This is really not acceptable. What would be the simplest way to fix this so that 8-bit images stay 8-bit images? Mason |
|||||||||||
|