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 corruption #63

Open
f2d opened this issue Nov 26, 2020 · 3 comments
Open

APNG corruption #63

f2d opened this issue Nov 26, 2020 · 3 comments

Comments

@f2d
Copy link

f2d commented Nov 26, 2020

Hi.

As APNG is explicitly supported here, I tried leanify -v on some of my files.
It appears to work and does not report anything suspicious:

Processing: 4_frames_good_from_gif2apng.png
PNG detected.
tEXt chunk removed, 36 bytes.
Filter strategy zero: 2409 bytes
4.57 KB -> 4.37 KB      Leanified: 203 B (4.34%)
Processing: 4_frames_bad_edges_left.png
PNG detected.
Filter strategy zero: 2407 bytes
24.08 KB -> 20.15 KB    Leanified: 3.93 KB (16.31%)
Processing: 4_frames_bad_edges_right.png
PNG detected.
Filter strategy zero: 2409 bytes
24.12 KB -> 20.17 KB    Leanified: 3.95 KB (16.37%)

But result either shows areas of garbled pixels after the first frame, or is completely not animated, depending on specific file.
XnView says that unplayable file is "multipage" instead of simply playing animation, and selecting its pages does not show any change.

Identical results with Leanify build 244, 243, and the last v0.4.3 release from the GitHub page.
Edit: Also identical results with build from latest source on a Linux server.

All files from gif2apng v1.9 (this was the best result I got back then, when I tried various ways to create APNG) become garbled.
Other files are probably from paint.net with plugins. They become unplayable.

I'm attaching the original and result files here.
apng_corruption.zip

I'm thinking to try creating APNG files with more recent software sometime later.

@JayXon
Copy link
Owner

JayXon commented Dec 10, 2020

This is because even though leanify will keep all the apng chunks, zopflipng and lodepng doesn't have native apng support
google/zopfli#118
lvandeve/lodepng#98
And in some cases an optimization will change the color type based on only the first frame, and that might break the rest of the frames.
It looks like setting keep_colortype will stop that from happening, but at the expense of missing many potential optimizations, but I think it's better than breaking the image, we can detect if it is apng based on existence of the apng chunks and set keep_colortype accordingly.

@Liam2349
Copy link

Liam2349 commented Jun 6, 2023

Hi, thanks for this tool. I just noticed this issue today in that Leanify is corrupting my PNGs that use alpha channels, or at least some of them. I just checked the latest Nightly build and it seems to have the same issue. Are you planning to implement the above fix?

Not pushing you, just wondering - thanks!

@JayXon
Copy link
Owner

JayXon commented Jun 6, 2023

@Liam2349 If your PNG isn't an APNG (Animated PNG), then it's a different issue.
By default Leanify will modify fully transparent pixels to make it more compressible, because those values don't affect how the image is displayed at all, but if you don't want this behavior, you can pass --png-lossless-transparent to the nightly build.

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

3 participants