libpng and zlib

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • libpng and zlib

      Hey All,

      I was just wondering if anyone has any experience loading PNG files from a byte stream that doesn't involve massive data duplication? My original attempts failed for some reason that I've given up on, but even those attempts would have been inefficient as libpng seems to want me to just copy byte data into their own internal buffer, which defeats the purpose of me already having all the data in memory.

      My current implementation of resource management involves reading a file completely in to memory, and then decompressing the data (if necessary). I have this implemented for TGAs (wrote my own parser) and it works quite nicely. I'm just wondering if anyone knows a good way to do this with libpng or if I should just write my own png parser? If I write my own png parser, should I still try to use the zlib APIs for decompression, or should I attempt to write that as well?

      Thanks,
      James