657 points · by todsacerdoti · 4y ago · 77 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.
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
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.
Is this source code available through MS partnership programs or an old leak?
https://news.microsoft.com/2004/02/12/statement-from-microso...
The repos I checked have all been DMCA’ed on GitHub, though.
GitHub is owned by Microsoft, does it even make sense for Microsoft to DMCA itself? It can just remove the content, or leave it, it owns the copyright and the platform, it can do whatever it wants (probably not, but IANAL).
Or maybe it happened before the acquisition.
// Okay, bug 30784 time. It's possible that we only got 1
// measly byte in the last data block. Rare, but it does happen.
// In that case, the additional byte may still not supply us with
// enough bits for the next code, so, as Mars Needs Women, IE
// Needs Data.
if ( end >= _gifinfo.lastbit && !_gifinfo.get_done )> You'll need to enable Javascript to see this section sorry! There's a slider that lets you see how changing the delay in a GIF file will affect the end results. It's pretty cool.
Thank you: this is an excellent way of handling the situation.
(For myself, I take care on my site in the few places I ever use JavaScript, and also even vary my content in feeds where it depends on JavaScript or site styles, which I’ve never noticed anyone else do. make-and-git-diff-test-harness and dark-theme-implementation are slugs of two sample articles that both vary by JavaScript and feed, I won’t drop links.)
Unfortunately I didn't document the process at all and have forgotten everything, so I can't give much useful info, apologies. Just know that there is pain down that path.
Prime example of trade-off between cleanliness of implementation and backwards compatibility. As much as I like a pristine, pure spec, the market winners are clear. It pays to keep product debt around.
For most standards documents, the HTML and PDF versions look just like the plain text version, adding little or no value (e.g. https://www.rfc-editor.org/rfc/rfc1321.txt ; https://www.rfc-editor.org/rfc/rfc1321.html ; https://www.rfc-editor.org/rfc/pdfrfc/rfc1321.txt.pdf ).
The only standard I am aware of with a decently formatted version is DEFLATE ( https://www.rfc-editor.org/rfc/rfc1951.txt ; https://www.rfc-editor.org/rfc/rfc1951.pdf ).
(Fortunately, this is all largely irrelevant nowadays.)
That is interesting & funny. I wonder why there wasn’t just a minimum value.
This article doesn’t talk about what happens after the delay is triggered, or that a value of 10ms won’t work for the average browser, video hardware & monitor. That’d be a refresh rate of 100 frames per second, and a lot of monitors are 60Hz refresh. Don’t browsers default to 60Hz refresh as well? (MDN docs mention requestAnimationFrame callbacks are usually 60/sec, or 16.7ms apart, for example.) This means with a timeout of 20ms, you’ll probably get a janky animation where one frame gets doubled every 6 frames. I guess with GIF it’s not possible to solve that since the spec doesn’t allow you to match typical refresh rates.
If your animation has <256 colors then it's even lossless, something not possible with any of the video codecs.
Webp is the more literal replacement for the GIF use case though and also has no color limitations in the lossless animation mode.
Which codecs? You can have eg. lossless H264 just fine.
If you know, you know.
There is a similar quirk in the RTF spec where x and y coordinates were swapped.
Along the lines of 'downloading Linux distribution ISOs'.
On this page, for example: https://legacy.imagemagick.org/Usage/anim_basics/ , scroll down to "-delay", and it just says "Set the time delay (in 1/100th of a second)..."
So, of course it doesn't exist!