-
Notifications
You must be signed in to change notification settings - Fork 1
Description
When loading 8-bit grayscale PNGs with Pillow, and converting them to RGB, they are converted like if they were 1-bit PNGs.
So basically, white,lightgrey,midgrey,darkgrey,black becomes white,white,white,white,black.
For now I'm implementing a workaround by converting all PNGs to lossless WebP as a transient format because cwebp is known to properly convert PNG to lossless WebP before loading the bitmap with Pillow.
For example I do PNG to WebP to TGA to convert from PNG to TGA.
This becomes crazy because we already did PNG to TGA to CRN to convert from PNG to CRN because crunch doesn't read all PNG formats. So, since we cannot do PNG to TGA in one go, I now do PNG to WebP to TGA to CRN to convert from PNG to CRN. This is really crazy!
Some code may now be highly unoptimized like PNG to WebP since the sanitization of the image is converted first to WebP before being converted to WebP again.
I plan to introduce a specific ImageConverter module to handle image conversion properly with the “shortest” (ahem) path for known formats.
This workaround is good enough to build Unvanquished 0.54 release.
Note: in the past we used ImageMagick convert tool to convert from anything to TGA but then ImageMagick broke TGA conversion (both conversion from TGA and to TGA) and maintainer is considering there is no bug, so this other tool is not an option anymore.
Something is wrong with PNG…