Jump to content
  • Advertisement
Sign in to follow this  
lanceking

Looking for a standalone PNG loader code.

This topic is 4877 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 am writing a simple game for cellphone and decide to use png as image file format. But I found libpng is too big and will bloat my binary code... Actually I think all we want from a png file is very simple: to load it. And I guess 8-bit index color and R5G6B5 format will suffice most of our needs. I digged into the libpng doc try to implement my own simple png loader but finally I give up. I am really not a Hoffman guy :( So I am thinking if there are simple standalone png file loader available, written in ansi c, easy to port? I think this piece of code will be useful for many of us. Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Given that libpng is open source, couldn't you just take it and remove all the bits you don't need/use?

Share this post


Link to post
Share on other sites
here is png loader i made many years ago
http://www.leviatech.fi/biki/download/png_c.zip
does not support 100% standart but loads most of images.

Share this post


Link to post
Share on other sites
Thank you so much biki_! I really love your code!

I've got a question, it seems to me that 8-bit paletted png
file does not compressed at all... Or only the palette is compressed?

Share this post


Link to post
Share on other sites
that depends on what you compress and what settings you are using
usually random noise will not compress at all. sometimes paletted images have bad properties for compression especially if it's a photograph with lot's of noise, which is not very visible but gives totally random index data.

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!