Wednesday, April 24, 2013

Why Do Chrome and Internet Explorer Display This Image Completely Differently?


In a rather curious case of confused identify, a photo of a piece of fruit changes itself based on what browser it is displayed it. What’s the secret behind the optical illusion? Is it a pear, an apple, or both?
Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

The Question

SuperUser reader Ethree writes:
Check this image out:

On Chrome and Firefox it will show as a pear. Now, try to save it and look at it saved on your desktop. Also, try viewing in safari or IE. It will display as an apple!
Try clicking the image and moving it around, you will notice the apple appears.
I guess my question will be, “why does this happen?”
Why indeed? We saw it as a pear in Chrome and, sure enough, when we saved it to our downloads folder it displayed as an apple.

The Answer

SuperUser contributor Matthew offers insight into the optical illusion:
The “white” pixels in the apple picture contain the picture of a pear, stored at a much higher intensity, i.e. very bright.

The “black” pixels in the pear picture contain the picture of an apple, stored at a fairly normal intensity, but scaled down to near black with the gamma correction.

The image contains a gAMA chunk specifying a file gamma value of 0.02. When displayed without gamma correction, the viewer sees an apple with “white” pixels interspersed, which are actually the pear at its original (high) intensity.
When displayed with gamma correction, the viewer sees a colour-corrected pear with “black” pixels which are actually the apple rendered at a much lower gamma value.
Browsers which display the pear are showing the image using the gamma information provided in it, while browsers which display the apple are not using this gamma information.
In other words, Chrome is respecting the gamma correction value and Internet Explorer is not.


No comments:

Post a Comment