News for hackers. Stuff that matters.
Re:PNG Is Back by armada651 on Wednesday June 25, 2025 @03:30AM (#44374550)
> Can animated PNG beat av1 or whatever?

Animated PNGs can't beat GIF nevermind video compression algorithms.

Re:PNG Is Back by jeroenhd on Wednesday June 25, 2025 @04:13AM (#44374811)
Once you add more than 256 different colours in total, GIF explodes in terms of file size. It's great for small, compact images with limited colour information, but it can't compete with APNG when the image becomes more detailed than what you'd find on Geocities.
Re:PNG Is Back by pornel on Wednesday June 25, 2025 @11:24AM (#44378383)
No, APNG explodes in size in that case.

In APNG it's either the same 256 colors for the whole animation, or you have to use 24-bit color. That makes the pixel data 3 times larger, which makes zlib's compression window effectively 3 times smaller, hurting compression.

OTOH GIF can add 256 new colors with each frame, so it can exceed 256 colors without the cost of switching all the way to 16.7 million colors.

Re:PNG Is Back by Aissen on Wednesday June 25, 2025 @04:34AM (#44374952)
> Animated PNGs can't beat GIF nevermind video compression algorithms.

Not entirely true, it depends on what's being displayed, see a few simple tests specifically constructed to show how much better APNG can be vs GIF and {,lossy} webp: http://littlesvr.ca/apng/gif_apng_webp.html

Of course I don't think it generalizes all that well…

Re:PNG Is Back by bmacho on Wednesday June 25, 2025 @06:28AM (#44375646)
I tried these examples on ezgif, and indeed apng manages to be smaller than webp every single time. Weird, I thought webp was almost always smaller. Is this because GIF images are already special, or apng uses better compression than png?

edit: using the same ezgif webp and apng on a H.264 source, apng is suddenly 10x the size than webp. It seems apng is only better if the source is gif

Re:PNG Is Back by Aissen on Wednesday June 25, 2025 @07:37AM (#44376096)
I have no idea! I actually hoped someone would show a much more comprehensive and serious benchmark in response, but that has failed to materialize.
Re:PNG Is Back by fc417fc802 on Wednesday June 25, 2025 @11:34PM (#44383964)
I would guess that apng only wins when indexed colors can be used. That guess would match what you saw using an h264 file for the source.
Re:PNG Is Back by account42 on Thursday June 26, 2025 @05:34AM (#44385690)
Almost like video codecs and animated images are different niches that optimize for different content.
Re:PNG Is Back by armada651 on Wednesday June 25, 2025 @02:21PM (#44380354)
You're correct and I was considering adding a footnote that if you use indexed colors like a GIF then PNG can beat GIF due to better compression algorithms. But when most people think of APNG they think of lossless compression rather than lossy compression.
Re:PNG Is Back by account42 on Thursday June 26, 2025 @05:32AM (#44385678)
Indexed can be lossless when the source already uses few colors, e.g. because you want to improve the compression of an existing GIF or limit colors for stylistic choice (common in pixel art).