javapngapng

Getting metadata of an APNG image


I am trying to get the metadata of an apng image at the moment. I have been able to get different frames from one apng file flawlessly and i am using PNGJ (a really great Standalone Java library for reading and writing PNG images), but I am not able to get the different info that is stored against every apng frame like delay of every frame.

I am at the moment just able to get the simple png image info that is stored in the header part by using

PngReader pngr = FileHelper.createPngReader(File);
pngr.imgInfo;

But I don't know how to have the information stored against the fcTL chunk. How can I do that?


Solution

  • You omitted the information that you are using the PNGJ library. As I mentioned in the other answer, this library does not parse APGN chunks (fcTL, fdAT). It loads them (you can inspect them in the ChunksList property) but they will be instatiated as "UNKNOWN" chunks, hence the binary data will be left in raw form. If you want to look inside the content of the fcTL chunks, you'd either parse the binary yourself, or implement youself the logic for that chunk type and register it in the reader (here's an example for a custom chunk).