Why can't Photoshop properly open this PNG?


Question

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

2012/02/10
1
9
2/10/2012 1:03:00 AM

Accepted 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.

2012/02/10
17
2/10/2012 1:57:00 AM

Your question is well answered by the folk above, but I though I'd mention a course of action for those who come after - you can open the indexed png in Preview.app or pixlr.com and resave the image as a png to get lossless access to the image. You can then resave the image in whatever format with PS.

I use Image Alpha and Image Optim for reliable output. Mor information in the article: “PNG that works”, which explains PNG8 format, and other PNG optimisation issues in more detail.

2013/05/07