for (int i = 0; i < image1Width; i++)
{
for (int j = 0; j < image1Height; j++)
{
if (image1.getPixelReader().getColor(i, j) != image2.getPixelReader().getColor(i, j)) return false;
}
}
This is what I have at the moment. I pass the function two Images (javafx.scene.image.Image). This means that this should never return false when the images are the same. Unfortunately, this returns false when I pass it the same image.
Thanks.
You need
if (!image1.getPixelReader().getColor(i, j).equals(image2.getPixelReader().getColor(i, j))) return false;
or
if (image1.getPixelReader().getArgb(i, j) != image2.getPixelReader().getArgb(i, j)) return false;
The second version may be faster.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With