Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APNG(Animated Portable Network Graphics) support #118

Open
PeterDaveHello opened this issue Jul 10, 2016 · 3 comments
Open

APNG(Animated Portable Network Graphics) support #118

PeterDaveHello opened this issue Jul 10, 2016 · 3 comments

Comments

@PeterDaveHello
Copy link

zopflipng currently will make APNG be a normal png, which we should prevent to, if APNG can not be supported, maybe add some detections to bypass the compress of APNG can be workaround.

APNG spec:
https://wiki.mozilla.org/APNG_Specification

APNG is an extension of the PNG format, adding support for animated images. It is intended to be a replacement for simple animated images that have traditionally used the GIF format, while adding support for 24-bit images and 8-bit transparency. APNG is a simpler alternative to MNG, providing a spec suitable for the most common usage of animated images on the Internet.
APNG is backwards-compatible with PNG; any PNG decoder should be able to ignore the APNG-specific chunks and display a single image.

APNG on wikipedia:

https://en.wikipedia.org/wiki/APNG

(PNG) specification. It allows for animated PNG files that work similarly to animated GIF files, while supporting 24-bit images and 8-bit transparency not available for GIFs. It also retains backward compatibility with non-animated PNG files.
The first frame of an APNG file is stored as a normal PNG stream, so most standard PNG decoders are able to display the first frame of an APNG file. The frame speed data and extra animation frames are stored in extra chunks (as provided for by the original PNG specification).

APNG demo:
https://people.mozilla.org/~dolske/apng/demo.html

Note that APNG is not supported in most of the browsers:
http://caniuse.com/#feat=apng

@CounterPillow
Copy link

zopflipng currently will make APNG be a normal png

Side note: This is a side-effect of Mozilla overloading the PNG mimetype with APNG, and one of the reasons why the libpng folks explicitly told them not to do this. They did it anyway.

@ericlaw1979
Copy link

There are two aspects of fixing this: First, minimally keep the required chunks (this can be worked around by end-users today using the proper command line). Second, enhance the tool to apply Zopfli compression to the additional image data stored in those chunks.

@JayXon
Copy link
Contributor

JayXon commented Jul 17, 2016

Actually, it's a little more complicated than that, if the apng is using palette, ZopfliPNG will remove "unused" color if it's not used in the first frame.
This will probably need some support for apng from lodepng.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants