static int img_width(BWImage image, int y) { int x2 = img_rightmostPoint(image, y); int x1 = img_leftmostPoint(image, y); return max(0, x2-x1); }