APNG vs GIF. Which is Better? [closed]
Asked Answered
F

4

17

I have been using Gifs for those small loading images. Have been working great except the occasional transparency issues and 8 bit colors. Now I found out about the APNG recently. But don't know if i should be using it. Does it have enough browser support? And what about the file size. A large gif image already has large file size...

Fetishist answered 16/7, 2014 at 7:8 Comment(9)
This question appears to be off-topic because it is about image formats, not programming.Rigidify
I think it is part of web design process. Is Stackoverflow only for Programming questions? Then why are CSS and HTML questions here?Fetishist
HTML/CSS are languages. GIF is not.Rigidify
... to be used in a web page.Fetishist
From the help center: monosnap.com/image/OpFbGZgQcJvvjRQQ0YI0NhyopDAj1i.pngRigidify
As of 1/2017, IE, Opera & Chrome support the apngHarman
Why is this "opinion-based"? It is entirely possible to give an objective answer which discusses file size, image quality, and browser compatibility. Even if the latter is a moving target, an objective answer can describe when each browser did introduce support, and where one would look for more up-to-date information on browser support.Phocine
@Harman as per the caniuse table in the top voted answer below IE (and Edge) does not seem to support apngBurdelle
@Phocine It is not about coding. I flagged it to be moved to Super User.Leap
H
24

I think APNG is better. As it supports 24-bit and 8-bit transparency. Moreover it is also supported by browsers like Mozilla Firefox, Chrome, Safari (see https://caniuse.com/#feat=apng).

Heisler answered 16/7, 2014 at 7:19 Comment(4)
As of March 14 2017, Chrome also supports APNG natively: chromium.googlesource.com/chromium/src/+/…Sue
As of April 29 2017, Chrome Beta adds support to animated PNG. Which hopefully will see full support of it by the time Chrome 59 is released.Victuals
Is APNG also considered better in terms of performance and/or RAM usage?Bangle
APNG is now being enshrined in the core PNG Third Edition spec by W3C along with other goodies.Acrylonitrile
S
8

Animated PNG is better than GIF if we're focused on file size – achieving a smaller file size was one of the reasons the APNG format was designed. In this image comparison test data, you can see that APNG is smaller than GIF for every image.

There is more browser support now (June, 2016) than there was when this question was asked. iOS Safari now supports APNG (since version 8) – that's a pretty big user base. So you can serve APNG to Firefox desktop and Android, Safari desktop and iOS, and serve GIF to all other browsers.

Cory Dowdy has some good comparison data here, including animated webp as well.

UPDATE 2018-12-4: Chrome, Opera, and desktop Safari now support Animated PNG. This has been true for several months.

Swope answered 19/6, 2016 at 12:40 Comment(2)
The differences in file size between APNG vs GIF are only 10% though...hmmmm. I suppose reducing the total web traffic in the world by 10% would be significant.Hoarsen
What about other factors that can be compared between them? Is decoding (and encoding, but less interesting) APNG faster than GIF? Or take less memory?Bangle
D
5

Apng is a better format. GIF and apng are both lossless, but apng tend to be smaller, and better quality (more colors, and the ability for transparency) Unfortunately apng are largely unsupported, but that may change. Hopefully apng catches on.

Dottie answered 7/10, 2014 at 6:48 Comment(2)
Ehem... GIF is not losless. For animation only supports a pallet of 256 colors per frame.Philip
GIF is lossless for a 256 color image. JPEG would not be lossless even on 256 colors. But for logos with usually less than 256 colors, GIF has been used for a long time as lossless alternative, because JPEG softened the edges.Honk
L
-8

Times have changed, please see below answers!


I'd definitely stick with GIF. I hadn't heard of APNG before, but from my research now, it sure sounds like it's almost unanimously unsupported. It sounds like Internet Explorer and Chrome don't support it, and that just seems useless for most users. Even if it is supported and my research on that was wrong, it's still only the most recent version or two that would. And for something where there's a very viable alternative, I'd hardly consider that risk to be worth it. And I know for a fact that my, latest version of IE didn't work with any of the example APNG files I came across.

It might be nice in a few years when/if it catches on, but for now it's just not a good idea.

Laquanda answered 16/7, 2014 at 7:12 Comment(3)
FYI, there's more browser support now, particularly iOS Safari and Mac Safari. APNG yields smaller files than GIF, so it might be worthwhile for high traffic sites – basically, the same scenarios where people go to the trouble to serve WEBP or JPEG-XR to the subset of browsers that support those formats (Chrome, IE 11, Edge, etc.)Swope
As of March 14 2017, Chrome also supports APNG natively: chromium.googlesource.com/chromium/src/+/…Sue
GIF is so limited that I'd drop it. Now all browsers support APNG. We better start taking advantage of that.Headline

© 2022 - 2024 — McMap. All rights reserved.