Friday, 26 October 2018

windows - Invisible PNG image layer that is only visible as a background


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?



Answer



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.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...