lilliput icon indicating copy to clipboard operation
lilliput copied to clipboard

Add support for APNG files (fix #101)

Open commandblockguy opened this issue 3 years ago • 5 comments
trafficstars

Currently, lilliput removes all of the APNG-specific data when resizing an animated PNG file, causing it to only output the first frame of the animation. This pull request adds a new encoder and decoder type for animated PNG files that properly handles subsequent frames.

GIF-to-APNG conversion currently does not work, since the number of frames in a GIF is not known until all frames have been read, while the total number of frames must be known before encoding the first frame of an animated PNG.

This change also requires an update to the dependencies to include the patch adding APNG support to libpng. Since I'm not sure what the process for updating them is, I haven't touched the dependencies beyond updating build-deps-linux.sh.

commandblockguy avatar Jun 02 '22 05:06 commandblockguy

Wow, this is pretty cool!

GIF-to-APNG conversion currently does not work, since the number of frames in a GIF is not known until all frames have been read, while the total number of frames must be known before encoding the first frame of an animated PNG.

I think this is fine. Discord's project that uses lilliput can allow or forbid certain source transformations. I would imagine others do as well. I will review some of the specific ergonomics around that to be certain though.

This change also requires an update to the dependencies to include the patch adding APNG support to libpng. Since I'm not sure what the process for updating them is, I haven't touched the dependencies beyond updating build-deps-linux.sh.

Appreciated. Obviously shipping binaries is not ideal but we do it to make lilliput a bit easier to plug and play. We have a trusted build process that generates these. Hopefully building there makes everyone feel a bit more comfortable about the contents of them.

About the PR specifically, Discord has made some product decisions about APNGs which, for better or worse, treats them as differently than GIFs. From that perspective my request would probably just be to make the logic selectable, so that we can keep using the old path for now. Unfortunately the freezing of PNGs has become rather load-bearing.

brian-armstrong-discord avatar Jun 02 '22 23:06 brian-armstrong-discord

APNG support would be a great addition. Anything I can do to help get this merged?

mateoconlechuga avatar Aug 19 '22 00:08 mateoconlechuga

We need this more than ever now that the most recent patch to PNG (addressing the aCropalypse issue) has broken APNGs using the *.png and *.apng extensions all together. Even opening them in the browser renders them static now... I made a plugin that allowed playback for it as a workaround but this flawed fix has resulted in ZERO APNG support whatsoever.

Knewest avatar Apr 02 '23 05:04 Knewest

Any word on when this will get merged?

mateoconlechuga avatar Aug 22 '23 15:08 mateoconlechuga