static Pt brightestPixel(BWImage img) { int w = img.getWidth(), h = img.getHeight(); new LPair l; int bestX = -1, bestY = -1, score = -1; for y to h: for x to w: { int val = img.getInt(x, y); if (val > score) { bestX = x; bestY = y; score = val; } } ret score >= 0 ? Pt(bestX, bestY) : null; }