Live data from Hacker News

Websites should not use dithered images

simplethread.com

121–130 of 133 posts

Re: Websites should not use dithered images

#122
post #99

Earlier quoted context omitted.

Doing this makes a lot of sense for any web setup where you already have something you're calling an "asset pipeline", but can seem pretty nuts where you're writing simple no-JS HTML.

It's really not bad: and you only need to bother with this on images it might matter (e.g. key large multi MB photos in a blog post or something not all of the 20x20 logo icons that would be less than 2kb even if uncompressed).

The HTML isn't bad, sure, but the process of generating appropriately scaled and formatted copies of images can be if you don't have other build steps that require similar automation.

Re: Websites should not use dithered images

#123
post #99

Earlier quoted context omitted.

Doing this makes a lot of sense for any web setup where you already have something you're calling an "asset pipeline", but can seem pretty nuts where you're writing simple no-JS HTML.

nothing about web for the last decade has been about no-JS HTML its an option but doesn't leave you anything to contribute. the web is fragmented most of the toolchain is for simplifying deployment into that fragmented place without caring that it is fragmented. so not really nuts when everything already takes care of it for you. you can stick with no-JS HTML cached on an edge node just as well, or not cached if you…

"everything already takes care of it for you" is fine if you're willing to have a dependency on "everything". It's "whatever" relative to how much the people who load your page care about bandwidth.

Re: Websites should not use dithered images

#125
post #122

Earlier quoted context omitted.

It's really not bad: and you only need to bother with this on images it might matter (e.g. key large multi MB photos in a blog post or something not all of the 20x20 logo icons that would be less than 2kb even if uncompressed).

The HTML isn't bad, sure, but the process of generating appropriately scaled and formatted copies of images can be if you don't have other build steps that require similar automation.

Appropriately scaled is always a problem at which point you hit save/export twice and you've done everything you need.

Unless rescaling an image itself is already too much work, in which case this has nothing to do with image formats or plain HTML sites in the first place.

Re: Websites should not use dithered images

#126

Earlier quoted context omitted.

It's much cheaper than decompressing a JPEG

Compressing, perhaps. But decompressing? Not really.

Floyd-steinberg dithering is at least an order of magnitude cheaper than JPEG decompression

Re: Websites should not use dithered images

#127

TLDR: There are much better compression algorithms than dithering

Dithering isn't a compression algorithm[1]. It's an algorithm that adds noise to effectively increase bitdepth when downsampling. In the case of images, it makes color-reduced versions not look terrible. Adding noise is almost always a bad thing for compression. The undithered images would compress much better. [1]: https://en.wikipedia.org/wiki/Dither

It is when combined with quantisation, and the article specifically refers to it as such.

Re: Websites should not use dithered images

#128

Earlier quoted context omitted.

Compressing, perhaps. But decompressing? Not really.

Floyd-steinberg dithering is at least an order of magnitude cheaper than JPEG decompression

Maybe if all else is equal, but let's not forget you'd be doing the dithering in javascript, and the JPEG decompression is implemented in a low level language, in practice probably hand written assembly (as performance-critical compression code often is).

Re: Websites should not use dithered images

#129
post #3

Curious if this is a commentary a propos a popular low-tech website we see around HN. I appreciate the dithering pattern, though I recognize it is not as efficient as, say, a compressed jpeg or a palette limited GIF.

If you read the article, it is very clear and direct about being a commentary on Low Tech Magazine

I did read the article, however the way I should have phrased it was that I was curious if the conversation the week prior from HN spawned this article. Always assume the most charitable interpretation before responding.

Re: Websites should not use dithered images

#130
post #62

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 is a technique which allows you to represent a color image with a very limited palette, in particular a two bit palette. To be way more pedantic, dithering is a technique to reduce the quantization error (what happens when you map values from a big, possibly infinite set to a smaller, finite set). This is done whenever a system or algorithm converts data from higher dynamic range representation (more bits…

> This is done whenever a system or algorithm converts data from higher dynamic range representation (more bits per quantum of signal, like a pixel or audio sample) to a lower dynamic range representation, it's called a bit-depth reduction.

You are mixing two things here? Bit depth reduction is a specific term, it refers to the reduction in the amount of information you want to _convey_.

Compression is be reducing the number of bits/pixel averaged across the whole image. Good compression algorithms will not be spatially uniform, it's entirely possible that pixels in some parts of the image are compressed with more bits/pixel than pixels in other parts.

Post reply on HN