Hacker News new | ask | show | jobs
by chmod775 1680 days ago
You're not as wrong as you think.

Dithering allows you to display images with a limited color palette, thus reducing the file size.

However the image formats chosen here don't really benefit from that.

Dithering is particularly effective in bitmap formats that use a palette (GIF, for instance). Just make sure your gif is actually saved with less bits-per-pixel than your original image.

It's however true that these formats that benefit aren't exactly modern, and there would be better ways of saving the same image.

At the end of the day, dithering can still be aesthetically pleasing. There might yet be a use for your app.

1 comments

> Dithering allows you to display images with a limited color palette, thus reducing the file size.

I think that sentence is misleading and is what caused the initial misconception.

Reducing the color palette is a technique for reducing file size. For example, say you have a grayscale image using 8 bits per pixel (256 colors). Ignoring other compression techniques, you can cut the size of the image in half by reducing it 4 bits per pixel (16 colors).

The naïve way to reduce bit depth is by discarding the low order bits, since they carry the least information. However, when you do that, the result is banding [1]. Banding is an unsightly artifact.

Dithering exists essentially to deal with banding. It works by (sort of) adding a slight amount of noise to the pixel values to diffuse the transitions between diffferent thresholds.

But anyone with an ounce of information theory will tell you that noise by definition is literally the hardest thing to compress. So when you dither an image, you are throwing away almost all of the gains you got by reducing the bit depth in the first place.

[1]: https://en.wikipedia.org/wiki/Colour_banding

This makes me think that one could store less significant bits of the channels with a lower spatial resolution ...

... Wait, this is what JPEG is, isn’t it? Why aren’t there dithering decoders for it, in this case? Is the block too small?