static RGBImage rgbRotate180(RGBImage img) { int w = img.getWidth(), h = img.getHeight(); RGBImage rgb = new(w, h); for y to h: for x to w: rgb.setInt(x, y, img.getInt(w-1-x, h-1-y)); ret rgb; }