Friday, April 5, 2019

Why can't Photoshop properly open this PNG?



When I try to open this image in PS (CS5) I get red rectangles around the parts of the image that are not transparent.


If I copy the image and paste it in PS I get the contents of the image, as seen via the browser, but with a built in black background (not transparent, as it really is)


What is wrong with this image?! Or is it my PS?


My PNG



Answer



Not sure about your exact instance, but I've often encountered PNG files that open with black or another color in place of the transparency. This is typically due to the PNG file using indexed colors and having an alpha palette rather than using a full alpha mask on the image itself.


Basically, when you normally save a PNG file, you're using full 24-bit truecolor (8 bits per channel) plus an alpha mask that stores the transparency info (basically another 8-bit channel). When you use palette colors, it indexes the colors as 24-bit RGB colors and keeps a separate 8-bit alpha mask.


However, PNG also supports alpha palettes. This means that each of your indexed colors is stored as a 32-bit RGBA color with the transparency data embedded in the palette. This is uncommon since it's difficult to do intelligently, and unfortunately it doesn't fit in with Photoshop's color modes. So when Photoshop opens it, it only reads the RGB components of each indexed color and doesn't find an alpha mask, so all the transparency data is lost.


I don't recall encountering a file where an arbitrary matte color is applied to the partially transparent regions, but this still could be a variation of the same problem.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...