A: 

The png could have the wrong gamma or color space, and it's getting converted on load, affecting the result. Some versions of Photoshop had a bug where they saved pngs with the wrong gamma.

David
I'm using GIMP, do you know how I might set this, I'm not really sure what gamma does or is. I'll look it up now. Cheers
gav
Check to see how the output differs from the input.
Nosredna
@Nosredna - Using pixel comparison? I was hoping to avoid that. It's easy for my Android implementation which I have verified as taking the xOr of the inputs but I'm not sure what the JAI is doing. I have to give a presentation on this tomorrow and I'd hoped not to have to write any more code :(
gav
Do a 4x4 image or something and see what's happening.
Nosredna
Is the dithering on the images happening when they are loaded, before they are XORed together?http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html#inDither
David
A: 

What are you doing prior to the code posted?

PNG is a compressed format, using the deflate algorithm (See Section 5 of RFC2083), so if you're just doing binary reads, you're not looking at actual pixels.

R. Bemrose
A: 

I checked a couple of values from your screenshot.

The input pixels:

  • Upper left corners, 0xc3cbce^0x293029 = 0xeafbe7
  • Nape of the neck, 0xbdb221^0x424dd6 = 0xfffff7

are very similar to the corresponding output pixels.

Looks to me like you are XORing two images that are closely related (inverted in each color channel), so, necessarily, the output is near 0xffffff.

If you were to XOR two dissimilar images, perhaps you will get something more like what you expect.

The question is, why do you want to XOR pixel values?

Liudvikas Bukys