Bug found in SDL_Image

I found a bug in SDL_Image. To reproduce it, call IMG_Load with the
PNG file located at the following URL:

http://chat.carleton.ca/~odagenai/pngbug.zip (20 k)

Immediately after IMG_Load, I called SDL_SaveBMP and got the other
file in that archive. Notice, with your favorite image viewer/editor,
that the BMP doesn’t look like the PNG.

What’s up with that?

Thanks!–

Olivier A. Dagenais - Software Architect and Developer

Did you tested it with 16,24,32 Bit Colors ???

CU

Do you happen to have colorkey or alpha set to a bright white color?
Premultiplied alpha is usually premultiplied against black.

Anyways, I loaded it up and it displays just fine.> ----- Original Message -----

From: owner-sdl@lokigames.com [mailto:owner-sdl at lokigames.com]On Behalf
Of Olivier Dagenais
Sent: June 9, 2001 9:18 AM
To: sdl at lokigames.com
Subject: [SDL] Bug found in SDL_Image

I found a bug in SDL_Image. To reproduce it, call IMG_Load with the
PNG file located at the following URL:

http://chat.carleton.ca/~odagenai/pngbug.zip (20 k)

Immediately after IMG_Load, I called SDL_SaveBMP and got the other
file in that archive. Notice, with your favorite image viewer/editor,
that the BMP doesn’t look like the PNG.

What’s up with that?

Thanks!

Olivier A. Dagenais - Software Architect and Developer


Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

No, I only noticed this problem with a 256-color PNG…–

Olivier A. Dagenais - Software Architect and Developer

“Torsten Giebl” wrote in message
news:9ftmvb$36g$1 at ftp.lokigames.com

Did you tested it with 16,24,32 Bit Colors ???

CU

IMG_Load returns a new surface that contains the image found at the
specified path, so I didn’t get to set any colorkey or alpha on it.
The code was like this:

(…)
SDL_Surface * someSurface;
someSurface = IMG_Load ( “map6.png” );
SDL_SaveBMP ( someSurface );
(…)

This is with SDL 1.2.0 (I’m pretty sure I’ve built SDL with VC++ 6.0)
and with SDL_Image 1.2.0 on Win32. libpng1.dll is 1.0.8. (it’s quite
possible this is a bug in libpng???)

Ideas?–

Olivier A. Dagenais - Software Architect and Developer

“Kisai” <kisai_z at yahoo.com> wrote in message
news:BAEJIFGAFGNHHPKILLHMEELNCAAA.kisai_z at yahoo.com

Do you happen to have colorkey or alpha set to a bright white color?
Premultiplied alpha is usually premultiplied against black.

Anyways, I loaded it up and it displays just fine.

-----Original Message-----
From: owner-sdl at lokigames.com [mailto:owner-sdl at lokigames.com]On
Behalf
Of Olivier Dagenais
Sent: June 9, 2001 9:18 AM
To: sdl at lokigames.com
Subject: [SDL] Bug found in SDL_Image

I found a bug in SDL_Image. To reproduce it, call IMG_Load with the
PNG file located at the following URL:

http://chat.carleton.ca/~odagenai/pngbug.zip (20 k)

Immediately after IMG_Load, I called SDL_SaveBMP and got the other
file in that archive. Notice, with your favorite image
viewer/editor,
that the BMP doesn’t look like the PNG.

What’s up with that?

Thanks!

Olivier A. Dagenais - Software Architect and Developer


Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

I found a bug in SDL_Image. To reproduce it, call IMG_Load with the
PNG file located at the following URL:

http://chat.carleton.ca/~odagenai/pngbug.zip (20 k)

Immediately after IMG_Load, I called SDL_SaveBMP and got the other
file in that archive. Notice, with your favorite image viewer/editor,
that the BMP doesn’t look like the PNG.

I cannot reproduce it (running on a Sun). Please verify that it is indeed
the png loader that is in error and not the bmp saver (try the tga saver
at ftp://ptah.lnf.kth.se/pub/misc/savetga.c). Also verify that the
palette after loading contains a perfect greyscale (so that
r,g,b[i] == i, i=0…255)

I found a bug in SDL_Image. To reproduce it, call IMG_Load with
the

PNG file located at the following URL:
http://chat.carleton.ca/~odagenai/pngbug.zip (20 k)
Immediately after IMG_Load, I called SDL_SaveBMP and got the other
file in that archive. Notice, with your favorite image
viewer/editor,

that the BMP doesn’t look like the PNG.
I cannot reproduce it (running on a Sun). Please verify that it is
indeed
the png loader that is in error and not the bmp saver (try the tga
saver

If I display the surface created by IMG_Load on the screen, it looks
like the BMP.

at ftp://ptah.lnf.kth.se/pub/misc/savetga.c). Also verify that the
palette after loading contains a perfect greyscale (so that
r,g,b[i] == i, i=0…255)

Loading up the BMP in PhotoShop4 and then taking a look at the
palette, I notice that the last entry is black.

I ended up grabbing the latest source from www.gzip.org/zlib/ as well
as www.libpng.org/pub/png/libpng.html and building zlib, libpng and
of course SDL_Image and now everything is fine, so it must have been a
bug in libpng 1.0.8, which was released almost a year ago. (Sam,
maybe next time you update SDL_Image you could have it use the most
recent libpng?? I could send you my binaries, if you’d like…)–

Olivier A. Dagenais - Software Architect and Developer