static int colorCount332(BufferedImage img) { int w = img.getWidth(), h = img.getHeight(); new BitSet bs; for y to h: for x to w: setBit(bs, ubyteToInt(to332(img.getRGB(x, y)))); ret bitCount(bs); } static int colorCount332(RGBImage img) { int w = img.w(), h = img.h(); new BitSet bs; for y to h: for x to w: setBit(bs, ubyteToInt(to332(img.getInt(x, y)))); ret bitCount(bs); }