stb_image as alternative to libJpeg + libPNG

stb_image as alternative to libJpeg + libPNG
0.0 0


Hi all,

I was wondering if there would be any interest in using stb_image for loading image files instead of libJpeg and libPNG, not only will this remove the dependencies on those libraries (stb_image is implemented in 1 c file) it also supports a lot of file formats (JPEG,PNG, BMP, TGA, PSD) I have previously used this code on the GameCube/PS3/Win/Mac/Linx so it’s certainly portable and I believe SOIL (Simple OpenGL Image Loader) uses it too.

Here is the file:

It includes lots of documentation (in the form of comments at the top)

If you want I can integrate this library and people can try it out with the benefits of a smaller build and more supported formats.

What do you guys think?

James Mintram


It’s great if it is stable.
Does any organization maintains it?


I believe it is indeed stable, it seems to be maintained by a few people (Mostly minor bug fixes when required)

Here is the last few revisions:
Latest revisions:
1.33 (2011-07-14) minor fixes suggested by Dave Moore
1.32 (2011-07-13) info support for all filetypes (SpartanJ)
1.31 (2011-06-19) a few more leak fixes, bug in PNG handling (SpartanJ)
1.30 (2011-06-11) added ability to load files via io callbacks (Ben Wenger)
1.29 (2010-08-16) various warning fixes from Aurelien Pocheville
1.28 (2010-08-01) fix bug in GIF palette transparency (SpartanJ)
1.27 (2010-08-01) cast-to-uint8 to fix warnings (Laurent Gomila)
allow trailing 0s at end of image data (Laurent Gomila)
1.26 (2010-07-24) fix bug in file buffering for PNG reported by SpartanJ

I have replaced the code CCImage for loading Jpeg and PNG files with calls to stb_image and it seemed to work straight away, I will replace the savePNG and save Jpeg methods as well (Although STB_IMAGE only supports saving to PNG)

James Mintram