lvandeve / lodepng

PNG encoder and decoder in C and C++.
zlib License
2.04k stars 420 forks source link

Feature Request: support APNG decoding #98

Open eustas opened 4 years ago

eustas commented 4 years ago

APNG is very simple extension over the PNG spec.

For basic support only one thing is required - pull the piece that decodes IDAT contents to API level.

fDAT chunk is basically uint32 "sequence number" plus IDAT contents.

lvandeve commented 4 years ago

Interesting idea to expose some internals to allow an external APNG implementation.

The piece that decodes IDAT is multiple pieces at the least:

-the part that takes the zlib stream out of one or more successive IDAT chunks, and that zlib decodes this (those are relatively simple, the zlib decoding is already part of the API),

-the part that outputs the pixels: this handles the PNG filters, the color encoding, interlacing, ... This is the one that is the most interesting to expose in the API for this, and should be able to take custom widths and heights

I'll consider this, but need to find some time and I'd like to ensure it's done in a good way, to not get regrets that can't easily be fixed in a backwards compatible way later (like some exposed API now unfortunately is ;))

jonsneyers commented 3 years ago

+1 on this feature request. Provided the application handles getting/setting the animation/frame info chunks, this would mainly require access to a lower level read/write api that can be used both for IDAT and for fDAT.