static L listOfBrightestPixels(BWImage img) { int w = img.getWidth(), h = img.getHeight(); new LPair l; for y to h: for x to w: l.add(pair(pt(x, y), img.getInt(x, y)); ret sortBySecondOfPairsDesc_inPlace(l); }