by xoa · 4y ago · 0 comments
That said at first I thought the author was being a bit tongue in cheek on the suggestion to fix it with:
>A downside to making any changes is that the badly formatted GIFs won't render any more. I reckon just be bold, like the release of Netscape 2.0...If Netscape was fine with breaking poorly-made GIFs, we should be too!
But we kind of have a bit more content now then when Netscape 2 was released, and it seems they're serious?
Support more than 256 colours in a single frame of GIF animation
Support fast GIFs (10ms delay)
No confusing behaviour with small delay = slow GIF
Better compression for GIFs with multiple small areas updated per frame
But frankly at this point why? We've got good universally adapted image formats that do more than 256 colors. We've got webm and so on (even Apple caved on that one in the end) for baked animation which is much smaller and more powerful than gif, and plenty of CPU and libraries for generation on the fly. We've got powerful ways to do animation purely with HTML/CSS/SVG/JS. GIF is a historical artifact with a lot of its value at this point purely about old things. This wouldn't even retroactively bring newer capabilities to older systems because it would require updated code which by definition means the ability to run new browsers and thus modern capabilities.I get they really enjoy hacking on gif but come on. Only way I can see it working is if all the players agreed on some metadata that could be added to gifs which wanted 'standards' vs 'historical' playback with the default remaining historical, and potentially also make it a browser setting. That'd still leave the ad issue, but maybe at this point that's moot given the advancements in blockers (and it'd be a very easy thing to look for as an indication of an ad, and thus be selected against).
The spiritual successor to animated GIFs — by that I mean nonlossy pixel-perfect animations — would be APNG, which is supported by virtually all current modern browsers: https://caniuse.com/apng
That sounds way less awesome, when you consider it only had 256 colors, so allmost all content did indeed loose a lot, by converting to gif.
And this is actually the first time I have heard of apng and interesting that it is even now widely avaiable. But I do not really see a broad use case, compared to webm.
Because file size matters usually much more, than pixel perfect animation.
I wanted to convert a short screencast to a gif, result: hundreds of megabyte big monster, with crappy quality.
The same with webm: 2 MB and good enough quality.
Nonlossy can be used for pixel perfect animations, lossy formats cannot.
> Because file size matters usually much more, than pixel perfect animation.
It depends. For video, that is true. For user interface, any glitch is distracting. Using JPEG for user interface images like buttons is in most cases a bad idea. Each format is useful in different situations.
> I wanted to convert a short screencast to a gif, result: hundreds of megabyte big monster, with crappy quality.
You are right, that is not a use case for GIF or equivalent formats.
In some sense, JPEG is just a really weird programming language. So a JPEG file is just a really weird program that gets interpreted by a JPEG decoder. Most normal JPEG encoders try to find a short 'program' in the 'JPEG programming language' that gets interpreted by the decoder to recreate a particular image reasonably well.
But there's no reason you couldn't ask for a perfect reproduction.
As far as I know, JPEG decoders are lossless and deterministic.
I asked this question on https://stackoverflow.com/questions/71201691/does-jpeg-allow... to get something definite.
Of course, you point still stands that JPEG is not a good file format for storing UI elements. Even if in theory you could torture the JPEG standard enough to make this barely work.
It is not, but this was still the main use case of gif - sharing short video sequences. With crappy quality, but it played everywhere. Apng is not the successor to that. Webm is, or will be.
So there might be niche cases in UI or games, where apng might make sense, but in most cases, I doubt people would see a difference between apng and webm - but they will notice faster or shorter loading times.
But my point was, that the main use case of gif, were short videos and animations, people shared. And for this, I am glad that webm seems now broadly avaiable for that role.
Per-frame palettes allow you to hack this a bit if you don't mind a few fractions of a second draw time for a static image¹² or only parts of the frame need to update each time for an animation.
Edit: some examples... A good illustration of the technique can be seen in https://commons.wikimedia.org/wiki/File:FullColour.gif and https://gif.ski/ is a practically pointless but brilliant tool for making high quality gif videos.
[1] or don't mind some dithering on the initial draw with the more colours added in subsequent “frames”.
[2] though for a static image, just use PNG
Another reason could be that Discord caches images on its servers to hide viewer's IP from the original server hosting the image. The caching involves compression that sometimes breaks the image.
GIF is still the only format that supports animated frames, and is supported in most applications that support images. I sometimes create some animated WEBP to post somewhere, but the outcome is always the same, I have to go back and convert it to GIF or it won’t display.