I got really bored so I wrote a simple dithering tool in Kotlin. It is surprising how little loss you get when reducing an image to 8 colors. Source code:

Wow that's quite something. I guess it's kind of like using more than one pixel as a pixel, displaying the colour using a number of dots... presumably it can't be saved as a jpeg though? Is it a png?

@puffinux It can be saved as JPG, but the result is quite poor

The algorithm only deals with one pixel at a time, but tries to distribute the errors to unprocessed pixels, creating more balance

Interesting... I've heard people say that as it reduces file size, it's a useful technique for sites that operate on poor internet speeds / for people browsing with slow internet.

@puffinux In theory you could represent a pixel as 3 bits without further compression

I'm not sure how that compares to other image encodings, but that would certainly be interesting... some sort of header defining it as an image, a load of binary, and something to close it off...

@puffinux I think that's more or less how PNGs work, with some lossless compression as well

Oh right 😅 I don't know what I'm talking about. Just thinking it through I guess.

@fred i get weird flickers when i scroll that image at 100% zoom. Looks surprisingly good when it's still though!

@fred I wonder if adding a very small gaussian blur by the image reader wouldn't enhance a bit the perceived quality
@fred Yep the result is not so bad, but maybe too blurry to be usefull.

Maybe there is an interesting compromise doable :
a way bigger picture with only 8 colors. The displayer blurs it and then shrink it.
I wonder if like this a picture would take less data than the original.

@lord here's the unblurred image, followed by an upscaled then blurred image, followed by the second image down-scaled

@fred not bad, no ?
the down-scaled one looks great.

BTW, the best way to get a good color reduction is to use some clustering algorithm to get the best color combination. There's plenty of relevant literature in the academia (key word: color quantization).

Self organizing networks like Kohonen's
( ) give out the best results.

@rick_777 looks interesting. Perhaps I'll try it out some day.

@tija being a masochist I'm sure she would like that

This just federated to me and I'm boosting it again thx still looks cool
Sign in to participate in the conversation

We are a cute and loving international community O(≧▽≦)O !