From 1a9433163b201225a90e78591e4bf7bc9aa4f46e Mon Sep 17 00:00:00 2001 From: Fatbag Date: Wed, 30 May 2012 00:04:41 -0500 Subject: [PATCH] Fixed a BGR->RGB swapping incompatibility with OptiPNG, which is even stated at the top of the file. Due to the state that it leaves libpng, and the fact that the libpng API offers no way to look at the transformed pixel data, this conversion must be done on the pixel data manually. --- Tools/iff2html/image.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Tools/iff2html/image.c b/Tools/iff2html/image.c index 337f0ee..ef27fef 100644 --- a/Tools/iff2html/image.c +++ b/Tools/iff2html/image.c @@ -66,6 +66,14 @@ int WritePNG(const char * OutName, const IFFChunk * ChunkData, const IFFSprite * Image.Width = Sprite->Width; Image.Height = Sprite->Height; Image.Data = Sprite->BGRA32Data; + + /* Swap from BGR to RGB; this cannot be done with libpng when you use opng_reduce_image + ** due to the state that it leaves png_ptr in */ + for(i=0; i