Advertisement


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

Lèse nailed it. It is indeed a PNG 8, with a truly odd palette. Here's how it opens in Fireworks, which both identifies and renders it correctly. The reason for the blockiness is apparent when you look at the table: every location but the transparent one has the same color. Anti-alias? We don't need no stinkin' anti-alias!

enter image description here

2012/02/10