It is overwritten, you just don't detect that visually with your
eyes. That is because you change the RGB values by just 1.
for (int x = 0; x < img.getWidth(); x++)
for (int y = 0; y < img.getHeight(); y++)
// check if the RGB integer is an odd number
if (img.getRGB(x, y) % 2 != 0)
// make it an even number if it is odd (the OCD god demands it!)
img.setRGB(x, y, 0); /// A ///
Change this line /// A ///
as I did and you'll see it is overwritten.
Of course it also depends on the picture you're testing this on.
If img.getRGB(x, y)
is never odd, the img.setRGB
will never be executed.