PNG decoder in 900 lines of code

Started by
5 comments, last by Lode 18 years, 7 months ago
I finished my png decoder! Supports any png file, the documentation is in the header file. It's the simplest png decoder I know, you only have to use 1 of the 2 functions to decode your png file. Could someone please help me betatesting it? I can't test 1-bit, 2-bit and 4-bit greyscale png's because The Gimp doesn't want to save such png's, and for the same reason I also can't test png's with a color key, and png's with a bit depth of 16 bit. And I didn't really test the alpha channels very well so far. Thanks! png.cpp png.h [Edited by - Lode on June 7, 2006 7:19:37 PM]
Advertisement
"lodePNG" / "lodePNG32"
We've been looking for a small PNG decoder with a reasonable licence for the JRALibrary. Would you allow us to port this to C for use in our upcoming opensource 2D software rendering library, as part of our internal image format support? All copyright notices will of course be left intact and you will be properly credited as a contributor. Whatever requirements you have for letting us port it to C, or if you have any objections or anything. Just post and hopefully we can talk it through.

Thanks.
JRA GameDev Website//Bad Maniac
Hey, feel free to port it to C, the BSD licence allows modifications. There aren't a lot of modifications needed to port it to C.

If I find bugs in the C++ version I'll fix them and post the bug fixes here.
I fixed a bug. However I can't post the code in source tags anymore, a gamedev script is timing out all the time.

So you can download the files here instead:

png.cpp
png.h

Sorry for bumping up this thread, but it was quite a stupid bug, it was making black pixels invisible. This is a very nasty bug, and it made me think OpenGL was making black pixels of textures invisible until I found out that this png loader was causing it!

[Edited by - Lode on June 7, 2006 7:38:20 PM]
You might want to rename the functions as Load instead of Lode - I didn't realise Lode was your name and assumed it was a spelling mistake.
I'll consider it for a next version :D

This topic is closed to new replies.

Advertisement