static int img_rightmostPoint(BWImage image, int y) { int x2 = image.getWidth(); while (x2 > 0 && image.getPixel(x2-1, y) == 1f) --x2; return x2; }