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.
views:
472answers:
3
A:
David
2009-06-22 17:19:32
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
2009-06-22 17:23:21
Check to see how the output differs from the input.
Nosredna
2009-06-22 17:38:51
@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
2009-06-22 17:42:24
Do a 4x4 image or something and see what's happening.
Nosredna
2009-06-22 17:59:11
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
2009-06-23 14:37:26
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
2009-06-22 18:45:44
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
2009-08-12 18:33:48