Invisible PNG image layer that is only visible as a background

48

18

I have recently came across a very peculiar image, with strange properties. The image is in PNG format and just shows a simple bird with a transparent background. My friend sent me the image with simple instructions just to save it and set it as my background.

Original image with just the seagull

After setting the image as my background a second image appears to show that in fact the seagull standing on a weapon:

Background image with a secret layer?

This at first got me very curious to the nature of the image and how to make such an image. I have opened the image in Photoshop and nothing out of the ordinary appears - the image is still the same as the transparent seagull, there is no hidden layers or masks to make it invisible. After checking the image in Photoshop, I had thought Windows made changes to the file when setting it as my desktop background - after navigating to %AppData%\Microsoft\Windows\Themes the image appeared to be the same.

Why does this image show a separate hidden layer or a completely separate image when set as a Windows Desktop Background compared to being viewed or edited in Photoshop?

Callum

Posted 2017-06-29T20:53:14.580

Reputation: 627

6

Open it with XnView, click "Remove Alpha Channel" , and you'll see the full image. Windows 7 converts backgrounds to JPEG, losing transparency https://answers.microsoft.com/en-us/windows/forum/windows_7-desktop/transparent-gif-as-desktop-background-picture/f4e1def4-05f0-41a3-807c-3c908cee2f83?page=1

– leonbloy – 2017-06-30T14:01:26.160

Answers

59

I'm guessing it's what was called "Dirty Transparency" in this article from Smashing Magazine.

Essentially any color in transparent PNGs can be described by an RGBA value, where RGB stands for the Red, Green and Blue channels and A stands for Alpha. The "invisible" colors can have any RGB values + 0 Alpha, meaning that the color will retain the original information, but render as transparent because its alpha is set to 0.

Why would you want to store the RGB values when Alpha is being used? So you can get smooth edges and transparent colors—unlike jagged edges in transparent-background GIFs. Transparency in PNG can go from 0 to 255, in GIFs it's either 100% transparent or opaque. To render something at, let's say, 50% transparency, you'll still need to know the RGB values, hence the value is stored. Most image editor software discard that RGB information when saving a fully transparent color, Photoshop included.

I can't speak for CC versions, but to see the "invisible" colors in older Photoshop versions you'll need a plugin. Pick one: Photofreebies or SuperPNG. SuperPNG seems more recent and less cluttered.

Why does the trick work? Wallpapers must be opaque because there's nothing "behind" them to show through, right? My guess is that Windows discards the Alpha channel information, revealing the hidden RGB values in the process.

Rhaenys

Posted 2017-06-29T20:53:14.580

Reputation: 652

6i just tried what you said by removed the transparency layer mask (alpha channel), that i had never occurred to me - by doing that i was able to replicate the effect. This is a very cool way of making backgrounds i think i will be exploring its trolling capabilities very soon :D – Callum – 2017-06-29T22:50:02.793

15I would say this is a bug in Windows. If the alpha value of a pixel is 0, then the pixel is transparant and the RGB values shouldn't matter. Windows should render an image that contains transparancy on top of something else, for example a white background. – Paul – 2017-06-29T23:32:23.433

5@Paul. Agreed, Except it would be the defined background color for the desktop, the same color that is used if the image is not stretched or tiled and is too small to fill the desktop. The metaphor is that the wallpaper is on top of a surface or wall of a solid color. – trlkly – 2017-06-30T02:46:44.767

3I would be very surprised if Adobe Photoshop was in need for a plug-in to achieve this - I'd expect it to offer controls similar to GIMP, e.g. adjusting the alpha values by curves or levels tools (that's only two of the many ways to make the transparent parts visible). – Michael Schumacher – 2017-06-30T09:47:46.063

2@MichaelSchumacher You'd be surprised by how Photoshop can be lacking in certain areas. To be fair I have no idea if the current CC version supports it already. I decided to stick with my perpetually-licensed PS, so my version is near obsolete by now. – Rhaenys – 2017-06-30T12:22:59.173

2@Paul You don't need to set the alpha to 0, however. Alpha 1 is incredibly transparent too, and it will evade most of those auto-discard features. – T. Sar – 2017-06-30T17:40:57.603

1To further what @CallumCarmicheal said, in Photoshop go to Layer -> Layer Mask -> From Transparency and then Layer -> Layer Maker - Disable. – Chris Haas – 2017-06-30T17:51:28.943

1@Paul Another answer suggests that this behavior is allowed by the PNG specification. If it is, then that seems a bug in the specification. – MarnixKlooster ReinstateMonica – 2017-07-02T05:14:37.083

13

To add to Nihal's answer, this can be reproduced by using the "anti-erase" brush in the GIMP. The Erase brush can add or remove an alpha channel if the image is using a format that supports it, (hold Alt to swap between erasing and anti-erasing).

For Krita, you can do this: Layer > Split Alpha > Alpha into Mask. After doing that you can hide or delete the Transparency Mask 1 channel that was just created and you'll see the full image.

Since the Windows background can't have anything behind it, it's probably just stripping out the transparency and displaying the image without it, (quick and dirty 32 bit image to 24 bit from the looks of it).

Blerg

Posted 2017-06-29T20:53:14.580

Reputation: 1 094

3

One point of clarification: This is not a bug, it is specified behavior in the png specification. Specifically the specification states that if a viewer or converter cannot understand transparency or transparency is not appropriate for a context or use the alpha channel may be ignored. Further the specification calls for all image generators to set the transparent colors so that the image is useful if the alpha channel is ignored. (my paraphrase, I has been a couple years since I read the spec.)

hildred

Posted 2017-06-29T20:53:14.580

Reputation: 506

1

Could you please try and find the relevant passage(s) from the specification? Because I cannot find this in https://www.w3.org/TR/PNG/. Thanks!

– MarnixKlooster ReinstateMonica – 2017-07-02T05:11:32.183