News for hackers. Stuff that matters.
Re:Hey Ho, GIFs Must Go (1999) by chungy on Saturday October 26, 2019 @11:45AM (#21364341)
More of a historic curiosity these days, the legal reasons to avoid GIFs 20 years ago don't exist anymore, the LZW patents have expired.

That being said, PNG always had much stronger compression, in addition to supporting 24- and 32-bit color. Nowadays, we even have WebP that usually compresses better than PNG, and compresses far, far better than animated GIF. Animated GIF is a pretty ugly hack to the format, very inefficient for many common kinds of animations (or full-blown video as it's often used now); I've found that animated WebP can produce files around 10% the size of GIFs.

Re:Hey Ho, GIFs Must Go (1999) by bbanyc on Saturday October 26, 2019 @03:34PM (#21365701)
LZW is a lovely algorithm. It's simple enough to explain in a page of pseudocode and fast enough to run on 1980s hardware easily. The compression rate is "good enough." If not for the patent issue, there'd be no reason to switch to the marginally better Deflate (which was only created in response to the patent). A shame Unisys got greedy and killed it before its time.

Though that's got nothing to do with why GIFs got so popular. That's purely because GIF is the only format that could display animations on every browser since 1995. The timing of PNG was rather unfortunate - the PNG team had decided on not supporting animation because GIF animation was rare and adding it to the spec would've unnecessarily complicated things. They froze the spec, planning to submit it to W3C and IETF for standardization - and then Netscape, in full "move fast and break things" mode, released Navigator 2 with animated GIF support. So soon every GeoCities page is full of annoying sparkly GIFs, PNG only lets you make boring stills, and we've got to support both formats forever.

Re:Hey Ho, GIFs Must Go (1999) by SiVal on Saturday October 26, 2019 @04:57PM (#21366133)
Well, a successor to JPEG called JPEG XL[1] that adds lossless compression, better lossy compression, the ability to further compress and then losslessly restore a traditional JPEG, HDR, animation, alpha channel, lots of other technical improvements, and a commitment by a long list of major players that if one of their patents is involved, it will be licensed at zero cost...is still scheduled to be officially published this month (Oct 2019).

[1] https://en.wikipedia.org/wiki/JPEG#JPEG_XL

Re:Hey Ho, GIFs Must Go (1999) by gsich on Saturday October 26, 2019 @07:57PM (#21367080)
JPEG also has lossless compression
Re:Hey Ho, GIFs Must Go (1999) by userbinator on Saturday October 26, 2019 @07:36PM (#21367001)
It's simple enough to explain in a page of pseudocode

More like a paragraph... https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Wel...

Personally, I like LZ more than LZW because it doesn't have to slowly "build up" the dictionary in the same way as LZW nor need bit-I/O (because you can have an 8, 16, or 32-bit "indicator", followed by that many literal or length/distance pairs) and thus makes for an even simpler (and faster) algorithm. The only downside is that it's more asymmetric, in that compression is usually far slower than decompression (which can be faster than memcpy() - see http://www.oldskool.org/pc/lz4_8088 ) because the former has to do a lot of searching while the latter is mainly copying memory.

Re:Hey Ho, GIFs Must Go (1999) by grenoire on Saturday October 26, 2019 @11:58AM (#21364422)
WebP is lossy though, no? The whole point of PNG is preserving the exact pixel data.
Re:Hey Ho, GIFs Must Go (1999) by javagram on Saturday October 26, 2019 @12:04PM (#21364458)
APNG is finally supported in every browser but IE/old Edge, so that case will be fixed soon too.

There’s also a lossless webp variant.

Re:Hey Ho, GIFs Must Go (1999) by daef on Saturday October 26, 2019 @01:04PM (#21364824)
https://flif.info beats lossless webm
Re:Hey Ho, GIFs Must Go (1999) by mceachen on Sunday October 27, 2019 @06:21AM (#21368845)
Re:Hey Ho, GIFs Must Go (1999) by chungy on Saturday October 26, 2019 @02:46PM (#21365455)
WebP has lossy and lossless modes. The latter should be considered as the PNG replacement :)
Re:Hey Ho, GIFs Must Go (1999) by lazyjeff on Saturday October 26, 2019 @04:48PM (#21366076)
WebP should be replacing JPEG and PNG. I feel like JPEG/PNG is like the GIF of 1999, formats which can be completely replaced with no real drawbacks. The disk space and network savings alone could reduce energy consumption. Safari is the only browser without WebP support, and I don't think it makes sense to keep waiting on them. If Safari users start seeing websites with images that don't load, Apple will support WebP real quick.

One thing that would be nice would be a way to tell whether a WebP is lossy (in which case you should only edit/resize the original file, to prevent degradation), or lossless (edit as much as you please).

Re:Hey Ho, GIFs Must Go (1999) by xvilka on Saturday October 26, 2019 @10:52PM (#21367619)
Apple users can also help by complaining[1] more. Interestingly, there is a bug[2] in Microsoft Edge which wasn't touched for months as well.

[1] https://discussions.apple.com/thread/250073758

[2] https://developer.microsoft.com/en-us/microsoft-edge/platfor...

Re:Hey Ho, GIFs Must Go (1999) by biddlesby on Saturday October 26, 2019 @05:19PM (#21366287)
It's wishful thinking that it would reduce energy consumption! If the format is more efficient people will just load more.
Re:Hey Ho, GIFs Must Go (1999) by TheSpiceIsLife on Saturday October 26, 2019 @07:46PM (#21367041)
Jevons Paradox:

In economics, the Jevons paradox (/ˈdʒɛvənz/; sometimes Jevons effect) occurs when technological progress or government policy increases the efficiency with which a resource is used (reducing the amount necessary for any one use), but the rate of consumption of that resource rises due to increasing demand.

https://en.wikipedia.org/wiki/Jevons_paradox

Re:Hey Ho, GIFs Must Go (1999) by zzo38computer on Saturday October 26, 2019 @02:47PM (#21365459)
I think FLIF seems better as a PNG replacement. FLIF is a lossless format, although lossy encoding is also available. Still, PNG is much better than GIF, so GIF should not be used unless you need it for use with software that can't use PNG.

(This kind of lossy encoding would be possible with PNG too, but most PNG encoders don't have a lossy mode.)

(GIF is now patent-free, but PNG and FLIF are still better compression than GIF anyways.)

Re:Hey Ho, GIFs Must Go (1999) by ZeroGravitas on Saturday October 26, 2019 @02:59PM (#21365520)
The FLIF author's next project FUIF is now partly the basis for JPEG XL which replaces (or at least aims to replace) PNG and all the other standard web formats.

Pngs get used for both for non photographic images and photographic images with alpha channel, and JPEG XL should win on both of those use cases.

It also cleverly has an upgrade story forexisting JPEGs so I imagine a fairly quick uptake where a proxy can recompress an existing sites images and get better size with no recompression loss.

Re:Hey Ho, GIFs Must Go (1999) by chungy on Saturday October 26, 2019 @03:26PM (#21365655)
I like FLIF too, but it has zero browser support, whereas all Chromium and Gecko browsers support WebP.

Something nice about FLIF is partial decoding. You can reasonably see a thumbnail by downloading just 5% of the full lossless file.

Re:Hey Ho, GIFs Must Go (1999) by ZeroGravitas on Sunday October 27, 2019 @07:32AM (#21369102)
This feature has been carried through to his work on JPEG XL, which is co-created with Google (using their Pik and Brunsli tech) and so fairly likely to get wide browser support.

In conjunction with HTTP2 to progressively load all visible images first, this is a killer feature for the web, simplifying thumbnails and responsive design while vastly speeding up page loads and improving caching.

Re:Hey Ho, GIFs Must Go (1999) by Lorin on Sunday October 27, 2019 @01:20AM (#21368004)
FLIF needs a catchier, pronounceable file extension name.
Re:Hey Ho, GIFs Must Go (1999) by ahbyb on Saturday October 26, 2019 @03:05PM (#21365534)
Is it supported at all by safari?
Re:Hey Ho, GIFs Must Go (1999) by gsich on Saturday October 26, 2019 @07:57PM (#21367076)
As Safaris usage is very low: likely not an issue.
Re:Hey Ho, GIFs Must Go (1999) by ckorhonen on Saturday October 26, 2019 @09:51PM (#21367431)
If you factor in iOS, usage is actually quite significant. Almost a accounting for almost a third of the market, making it the second most popular browser.

https://www.stetic.com/market-share/browser/

Re:Hey Ho, GIFs Must Go (1999) by gsich on Saturday October 26, 2019 @11:17PM (#21367698)
I don't.
Re:Hey Ho, GIFs Must Go (1999) by coribuci on Saturday October 26, 2019 @06:03PM (#21366529)
Right. Every day a new format.
Re:Hey Ho, GIFs Must Go (1999) by nebulous1 on Saturday October 26, 2019 @12:23PM (#21364569)
webp has both lossy and lossless compression
Re:Hey Ho, GIFs Must Go (1999) by mysterydip on Saturday October 26, 2019 @11:58AM (#21364420)
Was the original focus on size or performance for animated GIFs? The more you compress something, generally the more processing is required to restore it. I started using the web in the mid 90s, and animated GIFs were everywhere.
Re:Hey Ho, GIFs Must Go (1999) by nemo on Saturday October 26, 2019 @12:22PM (#21364558)
Pretty sure the original focus was just getting something that worked to display an animation. Animated gifs are an archaic, inefficient video format. Each frame of video is included in the file. You can optimize with a global color table and a few tricks to help cut size but they're incredibly inefficient compared to modern alternatives. Bigger sites like Twitter/Facebook convert gifs to .mp4s and serve .mp4 where possible since it saves a lot of bandwidth.
Re:Hey Ho, GIFs Must Go (1999) by ISL on Saturday October 26, 2019 @12:35PM (#21364644)
I suspect the key to the explosion of animated gifs was that everything supported gif and that it was largely incapable of nefarious/annoying activity (unlike flash).
Re:Hey Ho, GIFs Must Go (1999) by dredmorbius on Saturday October 26, 2019 @02:23PM (#21365315)
There's a fair bit of annoyance possible with GIFs, a fact I exploited when Google+ decided to:

1. Allow animations in the "Hero" user profile image.

2. Make that image permanently fixed to the top of the screen on the profile page.

3. As users increased window size to see more text and less hero, the image would scale to as much as 3/4 of the screen.

4. The hero was included on the "hover card" for users and would show up in all kinds of locations throughout the service. I still have that collection....

I spent an hour or so researching "annoying gifs", and settled on a rapid red-green-blue stroboscopic rotation. I don't know the cycle time, but it was probably a few times per second.

Google eventually relented. Well, they eventually shitcanned the whole site, but that's another story.

Trying to find animated images that weren't mind-bendingly annoying to me is how I ended up with the "space alien cat" image and avatar. The original had a rotating set of astronomical images in the glasses, I eventually applied the Crab Nebula as a static fill (tried the Cat's Eye, but ironically, it didn't work particularly well). That's the hero I use at several sites (Ello, Mastodon), and is the inspiration to the avatar I use as well.

Later at another site at which gratuitous annoying gif use was prevalent, I found a few static-but-apparently-moving optical illusion images, again to make the point that annoying images are annoying. The point was somehow missed by that crowd. That site also died.

TL;DR: animated gifs and even static images can be plenty annoying.

Re:Hey Ho, GIFs Must Go (1999) by jacquesm on Saturday October 26, 2019 @12:48PM (#21364720)
> Each frame of video is included in the file.

There is a trick where subsequent frames use transparency for non-changed parts of the image which gives a much better compression ratio than you might think.

Re:Hey Ho, GIFs Must Go (1999) by leeoniya on Saturday October 26, 2019 @01:48PM (#21365124)
this works well if you have a static background and a moving sprite. no so much if your background moves (or video).
Re:Hey Ho, GIFs Must Go (1999) by PavlovsCat on Saturday October 26, 2019 @01:55PM (#21365159)
The animated gifs that were everwhere generally were pixel animations rather than video.
Re:Hey Ho, GIFs Must Go (1999) by leeoniya on Saturday October 26, 2019 @01:59PM (#21365173)
well sure, when we had little bandwidth to even download a photo.
Re:Hey Ho, GIFs Must Go (1999) by PavlovsCat on Saturday October 26, 2019 @02:09PM (#21365245)
Not all animated pixel art was for lack of video, just like not all ascii art was and is for lack of images. Recording a video is a wholly different process to animating a 16x16 smiley. If anything, at least by now, I think more people record video because they can't draw, than people draw because they can't afford the equipment or bandwith for video.
Re:Hey Ho, GIFs Must Go (1999) by userbinator on Saturday October 26, 2019 @07:29PM (#21366971)
use transparency for non-changed parts of the image

In other words, similar to what video codecs do with "skipped macroblocks", except at a far more granular level. One wonders how efficient it would be if GIF was extended with things like motion vectors... but between the transparency/delta-enocding and the multi-palette "layering", you can sort of see the beginnings of a video codec.

Re:Hey Ho, GIFs Must Go (1999) by bbanyc on Saturday October 26, 2019 @06:26PM (#21366636)
There's also the trick where you can redefine the palette for each consecutive frame, and set the "delay" between frames to zero, in order to get more than 256 colors in a single image.

This is so horrendously inefficient it should be a crime. But it's still a GIF, and anything that can display animated GIFs can display it too.

Re:Hey Ho, GIFs Must Go (1999) by Dylan16807 on Sunday October 27, 2019 @02:05AM (#21368106)
Not that that means it will display entirely correctly. Browsers generally treat delays of 0 or 1 centiseconds as errors, and instead sit on that frame for a tenth of a second.
Re:Hey Ho, GIFs Must Go (1999) by Enginerrrd on Saturday October 26, 2019 @12:14PM (#21364519)
At the data rates we had available in the 90's, size was performance over the internet.

I am absolutely incredulous that people choose to use a GIF over a proper video format to share video on places like Reddit in this day and age. I don't understand the motivation to do so.

Re:Hey Ho, GIFs Must Go (1999) by hombre_fatal on Saturday October 26, 2019 @12:52PM (#21364741)
Well, these days imgur/gfycat will encode your gif as a video. Not sure I even see gifs much anymore.

Also, where have you been able to casually upload video to share quick bites like a cat making a funny face? You aren't going to upload a 12 second silent video to youtube. Up until very recently, gifs were the only permissible way to share this sort of content.

Re:Hey Ho, GIFs Must Go (1999) by pjc50 on Saturday October 26, 2019 @03:47PM (#21365771)
The huge advantage of gif was that it went in the <IMG> element. It behaves like a picture that moves, and can be uploaded to picture hosting services.

Video, until maybe the last 5 years, didn't.

Re:Hey Ho, GIFs Must Go (1999) by gsich on Saturday October 26, 2019 @07:58PM (#21367085)
It still doesn't. No loop control. Yeah you have HTML tags and whatnot, but the loop info must be inside the video itself, not as external metadata.
Re:Hey Ho, GIFs Must Go (1999) by edflsafoiewq on Saturday October 26, 2019 @09:04PM (#21367301)
Github is still full of GIFs for exactly this reason.
Re:Hey Ho, GIFs Must Go (1999) by cm2012 on Saturday October 26, 2019 @01:48PM (#21365122)
Because gifs can't have volume. I don't want my phone to make noises when I'm browsing the web.
Re:Hey Ho, GIFs Must Go (1999) by bredren on Saturday October 26, 2019 @01:52PM (#21365143)
There is also still generally more broadly supported preview rendering of gif vs newer formats.

Also probably more addressable / available tools for anim gif creation.

Re:Hey Ho, GIFs Must Go (1999) by caro_douglos on Saturday October 26, 2019 @02:43PM (#21365432)
Signal messenger doesn’t support webp across devices (last time I checked)....so I use jiffy format
Re:Hey Ho, GIFs Must Go (1999) by harshreality on Saturday October 26, 2019 @04:44PM (#21366059)
Then your browser should have an option to mute-embedded-video-by-default. Problem solved.

Don't blame a web video format/standard for UI failures.

Re:Hey Ho, GIFs Must Go (1999) by coribuci on Saturday October 26, 2019 @06:15PM (#21366591)
> Then your browser should have an option to mute-embedded-video-by-default. Problem solved.

I think you don't understand the modern web. If something is crappy the user shall have it. JS was always considered crappy but now is the best new thing. And you also missed tbe latest web/UI/UX development. From the web designer point of view the user is an idiot which must be punished for every attempt to customize something.

> Don't blame a web video format/standard for UI failures.

They are not UI failures. They are done on purpose.

Re:Hey Ho, GIFs Must Go (1999) by phkahler on Saturday October 26, 2019 @12:37PM (#21364658)
Because it's a "gif" not a WebP. If you want a format to catch on, the language needs to roll off the tongue. Even though I hate the word "podcast" and it sounds apple specific even though it's not, it sound a lot better than WebP.
Re:Hey Ho, GIFs Must Go (1999) by geofft on Saturday October 26, 2019 @01:48PM (#21365125)
"Do I look like I know what a JPEG is? I just want a picture of a got-dang hot dog."

https://youtu.be/QEzhxP-pdos

Re:Hey Ho, GIFs Must Go (1999) by buckminster on Saturday October 26, 2019 @01:06PM (#21364836)
I got the impression from the spec that it was originally designed to support retaining the compression dictionary across frames, which would have produced much smaller files at no cost to the decoder. But this wasn't explicit, it didn't get implemented, and the second spec ruled it out.

It could have very easily been better. I'm not sure what the moral is.

Re:Hey Ho, GIFs Must Go (1999) by BiteCode_dev on Saturday October 26, 2019 @01:04PM (#21364823)
But not supported by iOS Safari. And APNG not supported by edge. That's why sites like imgur use mp4 videos as an alternative to GIFs.

It's not that a bad deal though, one minute of video is roughly 7Mo for something close to DVD quality. I had GIFS lasting a few seconds weighting way more, with terrible quality.

Re:Hey Ho, GIFs Must Go (1999) by WilTimSon on Saturday October 26, 2019 @02:27PM (#21365341)
Yeah, it's a time capsule, sure, but a wonderful one. Just this part alone had me rolling: "Actually, they're going to draw on them with red markers -- setting fires in public places is against the law in California."

I'm not that well-versed in the matter, is WebP already supported widely? I mean, not just on desktop and advanced smartphones?

Re:Hey Ho, GIFs Must Go (1999) by maxst on Saturday October 26, 2019 @04:08PM (#21365877)
>I've found that animated WebP can produce files around 10% the size of GIFs.

For nicely optimized GIFs like these https://iwdrm.tumblr.com/ then WebP really struggles. Try to convert some of them to WebP and you'll see the result is often bigger than the original GIF.

Re:Hey Ho, GIFs Must Go (1999) by catalogia on Saturday October 26, 2019 @05:25PM (#21366325)
I don't know much about webp (my build of ffmpeg doesn't support it), but those gifs don't seem so small to me. Using the first gif on that page:

    Input #0, gif, from 'tumblr_nxt634tytr1qe0eclo3_r1_500.gif':
      Duration: 00:00:08.64, start: 0.000000, bitrate: 1434 kb/s
        Stream #0:0: Video: gif, bgra, 500x269, 16.67 fps, 16.67 tbr, 100 tbn, 100 tbc
vs

    Input #0, matroska,webm, from 'bar.webm':
      Duration: 00:00:08.64, start: 0.000000, bitrate: 252 kb/s
        Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv), 500x269, SAR 1:1 DAR 500:269, 16.67 fps, 16.67 tbr, 1k tbn, 1k tbc (default)
1434kb/s for the gif, vs 252 kb/s for the VP9 webm. Even this highly optimized gif is only highly optimized by gif standards.
Re:Hey Ho, GIFs Must Go (1999) by maxst on Sunday October 27, 2019 @02:40AM (#21368205)
I'm talking about WebP vs GIF. Not about video.
Re:Hey Ho, GIFs Must Go (1999) by Dylan16807 on Saturday October 26, 2019 @03:28PM (#21365668)
If you have aliased pixels, gifs can compress much better than video formats. It's really a shame when sites like twitter mangle those files into worse-looking and larger video files.

And as a side note: png does not strictly compress better; sometimes the ability to use palette indexes that are smaller than 8 bits is an advantage.

Re:Hey Ho, GIFs Must Go (1999) by chungy on Saturday October 26, 2019 @07:15PM (#21366890)
> sometimes the ability to use palette indexes that are smaller than 8 bits is an advantage.

PNG does support 4-, 2-, and 1-bit indexed modes :)

Re:Hey Ho, GIFs Must Go (1999) by Dylan16807 on Sunday October 27, 2019 @01:45AM (#21368060)
Huh. I wonder what caused those very few color gifs to be smaller then... maybe an encoder shortcoming?
Re:Hey Ho, GIFs Must Go (1999) by nine_k on Saturday October 26, 2019 @12:05PM (#21364466)
Is webP as free as PNG? I remember that its not taking over the world had a licensing component in it.
Re:Hey Ho, GIFs Must Go (1999) by Symbiote on Saturday October 26, 2019 @01:17PM (#21364912)
The article is much more about software patents than one case of their abuse, so it's still very much relevant today.