Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Check this image out:

Apple or Pear

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 Internet Explorer. It will display as an apple!

Try clicking the image and moving it around. You will notice the apple appears.

Why does this happen?

share|improve this question

migrated from stackoverflow.com Apr 7 '13 at 8:33

This question came from our site for professional and enthusiast programmers.

    
if I try to drag the image on firefox just a little bit, the transparently dragged image will make the shape of the apple aPear –  ajax333221 Jan 22 at 4:19
1  
How did you create this picture? Can you point me to a website? –  tumchaaditya Feb 11 at 19:44
3  
For future readers, this seems to be fixed in current versions of IE. –  Mike Feb 13 at 20:09
1  
But you can still download it to your desktop and see apple there, and view it in Firefox, Chrome as pear. –  Jet Jun 22 at 21:19
1  
This scared the shit out of me. –  Gintas_ Aug 7 at 21:05

5 Answers 5

This was a little too much for a comment, but hopefully it helps.

So, I am fairly certain that this issue deals with the way the browsers interpret gamma information with PNGs. It's a pretty fun problem and deals with the ambiguities of gamma information in the first place.

The article The Sad Story of PNG Gamma “Correction” provides a very nice summary of the issues, remedies, and other fun facts.

With that said, we can actually strip the gamma information from an image using pngcrush

pngcrush -rem gAMA -rem cHRM -rem iCCP -rem sRGB pear.png apple.png

So with the gamma information and without it:

pear an apple

I wouldn't really say this is "the answer", but if anything it is probably in the right direction. I am sure someone with a lot of knowledge concerning color-profiles and so on will come along with a more formal response.

share|improve this answer
8  
voilà* –  Ricket Apr 7 '13 at 4:37
3  
those two images look the same to me, flickering between apple and pear just like the original in the question. I am using Safari 6.0.2 –  Fraser Graham Apr 7 '13 at 6:52
16  
Thinking about it, thats exactly what I should see if my browser is ignoring gamma information. –  Fraser Graham Apr 7 '13 at 6:54

The "white" pixels in the apple picture contain the picture of a pear, stored at a much higher intensity, i.e. very bright.

Uncorrected image

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.

Corrected image

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.

share|improve this answer
7  
A recommended reading on the topic: the famous article by Eric Brasseur called "Gamma error in picture scaling. –  ulidtko Apr 9 '13 at 8:51

Changing the gamma of an image consists in modifying the value gamma in:
(R',G',B') = (Rɣ, Gɣ, Bɣ)
which gives the output pixel color (R',G',B') displayed on the screen after applying the gamma function to the initial pixel values (R,G,B) (considering R,G, and B normalized between 0 and 1).

Now, let's take the red channel for example.
If R = R0+R1 , you will obtain
R' = (R0+R1)ɣ = R0ɣ * (1+R1/R0)ɣ

If R0 is much bigger than R1, then you have
(1+R1/R0)ɣ ≈ 1 + ɣ*R1/R0,
so R' ≈ R0ɣ + ɣ*R1*R0ɣ-1

This means that for gamma close to 0, R0ɣ dominates. For ɣ=1, you get
R' ≈ R0 + R1

Fo a large gamma, the second term dominates, so that you can directly setup R0 = red component of the pear and R1 = red component of the apple, with R0 much larger than R1 and you will obtain the desired variations when changing the gamma of your monitor (or the particular gamma curve each software uses).

share|improve this answer

It's not rounding pixels and the ICC color profiles are not the issue.

It's a trick image, and some browsers display PNGs without gamma data. For those browsers, you see one thing, and for other browsers you see the full image (with the pear hidden in the background).

I see either a apple/pear trick image, or I just see the pear, depending on if the browser supports this gamma data.

share|improve this answer

well as it happends, you can see more details in pictures with a proper calibrated display and if the gamma/brightness/contrast is way to high, you can see the one image in the picture is hidden more

share|improve this answer

protected by Daniel Beck Apr 7 '13 at 15:47

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.