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开发者_Python百科 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?
Look for png_set_read_user_chunk_fn
in the manual. There are standard functions for accessing the standard chunks once they have been read, and custom chunks are handled by invoking a custom callback.
精彩评论