How to convert a 24 Bit PNG to 3 Bit PNG using Floyd–Steinberg dithering? java.awt.image.BufferedImage should be used to get and set RGB values.
On wik
source code needs the missing method "diff" in the static class C3. otherwise, it doesn't compile or work.
here's the missing diff method:
public int diff(C3 o) {
int Rdiff = o.r - this.r;
int Gdiff = o.g - this.g;
int Bdiff = o.b - this.b;
int distanceSquared = Rdiff*Rdiff + Gdiff*Gdiff + Bdiff*Bdiff;
return distanceSquared;
}