How do I read an arbitrary chunk from a PNG file?

Posted by Mason Wheeler on Stack Overflow See other posts from Stack Overflow or by Mason Wheeler
Published on 2010-04-02T20:07:30Z Indexed on 2010/04/02 20:13 UTC
Read the original article Hit count: 310

Filed under:
|
|

I've got some custom metadata to put into a PNG file. It's being saved through libpng, and it's not difficult to write out a custom chunk. I just call png_write_chunk with the name, length and data. But I can't see how to get the data back out again. I'd expect there to be a png_read_chunk function that takes a chunk name and returns a pointer to the data or something like that, but there's nothing like that in png.h.

Does anyone know how to accomplish this?

© Stack Overflow or respective owner

Related posts about png

Related posts about libpng