Page MenuHomePhabricator

For users whose browser doesn't support APNG files, show them an animated GIF of the file instead
Closed, DeclinedPublic

Description

Lots of users (essentially, anyone who uses a browser other than Firefox) have browsers that don't support APNG files. Instead, their browser will interpret it as a regular PNG file and just show the first frame.

A nicer failure mode would be to give everyone a GIF file instead, and then at runtime use some client-side JS to sniff for the feature and if present replace the GIF with the APNG instead.

See also:

Details

Reference
bz53167

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 22 2014, 2:07 AM
bzimport set Reference to bz53167.
bzimport added a subscriber: Unknown Object (MLST).

For reference, example apng file: https://en.wikipedia.org/wiki/File:Animated_PNG_example_bouncing_beach_ball.png


Would probably require new software deployed to server (I don't think image magick supports apng->gif, but not sure). Googling suggests http://apng2gif.sourceforge.net/

Note the general problem with APNG->GIF is that you may have to apply two lossy transformations:

  • color quantization to an 8-bit palette, probably with dithering
  • 8 or 16-bit alpha channel -> 1-bit alpha channel

Both of these will potentially leave a GIF version looking like crap, and most people will get the crappy version. :(

I'd kinda prefer to phase out animated GIF in favor of proper video formats, editable slideshows of static images, or animated SVG... introducing APNG basically just gives us a slightly better animated GIF exclusively for Firefox users.

lowering priority in light of comment 2. Possible wontfix

(In reply to Brion Vibber from comment #2)

I'd kinda prefer to phase out animated GIF in favor of proper video formats,
editable slideshows of static images, or animated SVG...

That's a nice theory, but it's highly unlikely to actually happen given the low uptake in the toolchain; APNG isn't widely used either, but ASVG is almost unknown IME.

introducing APNG basically just gives us a slightly better animated
GIF exclusively for Firefox users.

Firefox users and those who care about these things and so have browser plugins/etc. :-) But yeah.

Ciencia_Al_Poder set Security to None.
Ciencia_Al_Poder removed a subscriber: Unknown Object (MLST).

All modern browsers support this now, and IE11 is on the way out. https://caniuse.com/?search=apng

I don't think we will ever implement something for this ;)

FYI: Converting is very simple https://packages.debian.org/bullseye/apng2gif

@TheDJ Agree that it will never be implemented, especially because PNG has an 8-bit alpha-channel and gif only a 1Byte. and 24bit-PNG can handle ~16.8 million colours, but GIF only 256 Colours.

However animated Gifs are rescaled to rendered in different resolutions:
https://commons.wikimedia.org/wiki/File:Rotating_earth_(large).gif is scaled to e.g. https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Rotating_earth_%28large%29.gif/120px-Rotating_earth_%28large%29.gif?20190827115610
But APNGs are always delivered in the original resolution (but scaled in the browser):
https://commons.wikimedia.org/wiki/File:Animated_PNG_example_bouncing_beach_ball.png always refers to https://upload.wikimedia.org/wikipedia/commons/1/14/Animated_PNG_example_bouncing_beach_ball.png?20170225204533

@TheDJ Should we create a new task for resizing APNG on Thumbor ?

@TheDJ Should we create a new task for resizing APNG on Thumbor ?

@JoKalliauer probably yes...
Actually, well need two tasks. One for MediaWiki core (which should be pretty simple as I think we can just add a check which adds coalesce to the imagemagick png transform) https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/e3f5fdd8b1ba0afe572bde8a9b18665c50837d41/includes/media/BitmapHandler.php#210

We'll apparently also need to tell imagemagick that its an apng, by prefixing it with APNG:

And then we also need to implement it in thumbor indeed. Unfortunatley, I believe WMF is a bit stuck with thumbor right now, but they were hoping to put some effort into it in the coming year... ?

Per last comments, would someone create a Thumbor task that has this task T55167 as subtask, and set its status to stalled? Thanks in advance.