Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

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

share|improve this question

4 Answers 4

up vote 11 down vote accepted

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.

share|improve this answer
2  
Yep, that's an indexed-color PNG all right. I just tried opening it in GIMP, and the text looks really blocky because it's using 1-bit transparency in indexed color mode. However, simply changing the color mode to RGB fixes it; you could try and see if the same trick might work in Photoshop too. –  Ilmari Karonen Feb 10 '12 at 2:23
    
changing to RGB in PSD did not reveal the image as it is supposed to look... –  Gaia Feb 11 '12 at 14:23

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.

share|improve this answer

Web designers sometimes use Fireworks to save 8-bit PNG files with an alpha-transparent channel as it enables some of the older browsers to handle alpha-transparency more reliably without proprietary hacks or IE CSS filters etc. The colour profiles in Photoshop won't recognise or render this correctly though.

share|improve this answer

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

share|improve this answer
    
Yea, so basically Photoshop is showing only the RGB data of the palette. Every indexed color has an identical RGB component, but each has a different alpha value between 255 and 0. I guess Photoshop is hardcoded to show any color with an A value of 0 as "transparent" (the little diamond thing) but doesn't know what to do with A values between 1 and 254, so it just treats it as a solid red. –  Lèse majesté Feb 10 '12 at 7:44
    
That's Fireworks, not Photoshop. –  Alan Gilbertson Feb 10 '12 at 8:27
    
Ah, sorry. I looked at the palette in Photoshop, and it's something similar, except it shows 119 extra colors after the 137 displayed in Fw. The extra colors are repeating shades of gray, so I'm not really sure what's going on there. But changing it to RGB color definitely doesn't fix things as it does in Gimp. –  Lèse majesté Feb 10 '12 at 8:46
1  
The advantage with FW is that PNG is its native file format, so it's a lot smarter about "all things png" than Photoshop. The image opens up exactly as you see it in the capture. FW is still on my list of applications to dig into more deeply. Meanwhile, it's handy for this kind of diagnostic. –  Alan Gilbertson Feb 10 '12 at 19:12
    
Thanks, it definitely helps to know I can use FW to read it correctly. –  Gaia Feb 11 '12 at 14:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.