static Rect rectOfDifferentPixels(RGBImage img1, RGBImage img2) { rgbImageAssertSameSize(img1, img2); Rect r = null; int w = img1.getWidth(), h = img1.getHeight(); for y to h: for x to w: { if (img1.getInt(x, y) != img2.getInt(x, y)) if (r == null) r = singlePointRect(x, y); else extendRectToIncludePoint_modifyOriginal(r, x, y); } ret r; }