Jump to content
  • Advertisement
Sign in to follow this  
Lode

PNG decoder in 900 lines of code

This topic is 4829 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!