static BWImage transformBufferedImageToBWImage(IF1 f, BufferedImage img) { if (img == null) null; int w = img.getWidth(), h = img.getHeight(); BWImage img2 = new(w, h); for y to h: for x to w: img2.setPixel(x, y, f.get(img.getRGB(x, y))); ret img2; }