Getting metadata of an APNG image

693 views Asked by At

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?

2

There are 2 answers

0
leonbloy On BEST ANSWER

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).

1
maxst On

Look at how you're currently reading 4-bytes integer 'seq' from fdAT.

You can read information from fcTL the same way.

Just keep in mind that some info is stored in fcTL as 4 bytes, some as 2 bytes, and some as 1 byte.