Live data from Hacker News

Websites should not use dithered images

simplethread.com

31–40 of 133 posts

Re: Websites should not use dithered images

#31
post #25

I don't get this article. Dithering is generally for limited palettes. JPG, PNG do not have limited palettes. This feels like a strawman.

As the OP says, but maybe not clearly enough, it's a response made to these claims/suggestions by lowtechmagazine.com:

https://www.lowtechmagazine.com/2018/09/how-to-build-a-lowte...

They do use dithering with JPGs and PNGs on their "solar-powered website" variant, which I won't link-to so as not to contribute to draining the battery with an HN effect.

The first image I found to compare from the two versions of their own website... the dithered version is 65K and the original is an incredible 6.2MB... but that's at least in part because the original is 5053x3581 pixels and the dithered is 1213x600! First picture at https://www.lowtechmagazine.com/2021/11/fascine-mattresses-b... is the "non-dithered" variant. There may be other compression mis-choices on the original JPEG as well. To suggest this size difference is due to dithering would be misleading!

Size and compress your images properly (including JPG lossy compression) to save energy resources is good advice; I think the OP is probably right that dithering is not a very useful tool in that toolkit.

It makes me lose some respect for lowtechmagazine, when they go for more style over substance in this particular case, it makes me wonder in others.

Re: Websites should not use dithered images

#32
nathaniel here, writer of the article this article is referencing.

If it's okay with you I'll update the original with a link to this at the top. It's sort of hilarious that I made an whole app based on a premise that is basically just wrong.

I wish I could say I've learned my lesson, but I'll probably continue to make enjoyable mistakes like this for the rest of my life.

Re: Websites should not use dithered images

#33
post #25

I don't get this article. Dithering is generally for limited palettes. JPG, PNG do not have limited palettes. This feels like a strawman.

The article is a rebuttal to this article (https://endtimes.dev/why-you-should-dither-images/), which in fact used photographic images, so definitely not a straw-man article in this case.

Mpqzcp nzxxpyetyr htes pxzetzylwwj-nslcrpo nzxxpyed, dpp tq jzfc nzxxpye xlvpd dpydp ty esp nzyepie zq esp lcetnwp lyo yze ufde esp etewp. Nzxxpyetyr hteszfe vyzhtyr esp nzyepie xlvpd jzf wzzv (opdpcgtyrwj) defato.

Re: Websites should not use dithered images

#34
post #25

I don't get this article. Dithering is generally for limited palettes. JPG, PNG do not have limited palettes. This feels like a strawman.

PNG can have limited palette. Back in the days saving an image as 8bit PNG was a nice trick to save on size when one needed transparency and/or shadows.

Re: Websites should not use dithered images

#35

Isn’t the whole point to switch to a palleted image when you dither? If you are leaving it truecolor it just makes the image worse for no benefit as the article noted. Switching to a palleted PNG however can save a lot of bits in certain circumstances. That said just pulling out a good lossy encoder makes a lot more sense most of the time. It is easier and it will look better. Dithering is lossy anyway.

Yes, exactly. Indexed PNG makes for really small files. Especially when you don't use much colours (for 256-color-index, the saving is not really there, but if you are like <8, it's worth it - if the image fits, style-wise, of course).

Re: Websites should not use dithered images

#36

Lesson learned: test your optimizations. I will admit I'm surprised by the results. I assume there's not really a rendering perf hit from WebP vs jpg? Also, the preposition that lowering the file-size, and therefore transfer time, is the most important factor in environmental impact is, I think, a little under-supported. That being said, the original Low Tech Magazine article's perf claim is back up from the data, bu…

Low Tech Magazine Article on the whole site...which mentions dithering: https://www.lowtechmagazine.com/2018/09/how-to-build-a-lowte... """Compressed through this dithering plugin, images featured in the articles add much less load to the content: compared to the old website, the images are roughly ten times less resource-intensive.""" There's an assertion which implies data, but no data. But accepting that there was…

I don't have the numbers handy anymore, but I did some testing on that assertion and their dithered pngs look absolutely worse than a JPG or WebP of the same filesize, as you'd expect.

Re: Websites should not use dithered images

#37

The idea that dithering should be used to reduce your image size is a misunderstanding of image compression. Dithering is a technique which allows you to represent a color image with a very limited palette, in particular a two bit palette. The result is not much like a normal photo, but much better than nothing if you have a machine that can only output a few colors. (You could think of that as a sort of compression…

Dithering would, in theory, work well for compression if you use a palette. GIF always does that, PNG also has a palette mode.

JPEG, WebP, and AVIF use various frequency-domain transforms. These work best for smooth color transitions, like in photos. They're generally terrible for sharp edges (as found on screenshots), and especially so when many neighboring pixels have drastically different colors.

Re: Websites should not use dithered images

#39
The dithered example is a bit disingenuous, since it coaxes the picture into a palette that is clearly not suitable, causing an egregious amount of artifacting.

I don't know what's going on with their dithered image sample:

https://3otebq2knmnf3smsj0374a9u-wpengine.netdna-ssl.com/wp-...

This is the same dithered image with a sane 16 color palette:

https://www.marginalia.nu/color-simple_500-better-palette.pn...

Further, human eyes are kind of bad at blue colors, so whatever compression artifacts you get with JPEG or WebP is going to be really hard to detect. (The blue channel is typically compressed much harder by many algorithms because of this).

Re: Websites should not use dithered images

#40

nathaniel here, writer of the article this article is referencing. If it's okay with you I'll update the original with a link to this at the top. It's sort of hilarious that I made an whole app based on a premise that is basically just wrong. I wish I could say I've learned my lesson, but I'll probably continue to make enjoyable mistakes like this for the rest of my life.

This was a fantastic and gracious response. Nicely done!
Post reply on HN