static BWImage img_distanceFromColor(RGBImage img, RGB color) { int w = img.getWidth(), h = img.getHeight(); int col = color.getInt(); BWImage bw = new(w, h); for y to h: for x to w: bw.setPixel(x, y, rgbDiff(img.getInt(x, y), col)); ret bw; } static BWImage img_distanceFromColor(BufferedImage img, RGB color) { ret img_distanceFromColor(RGBImage(img), color); }