9

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

6 Answers 6

17

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.

2
  • 3
    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. Feb 10, 2012 at 2:23
  • changing to RGB in PSD did not reveal the image as it is supposed to look...
    – Gaia
    Feb 11, 2012 at 14:23
5

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

5
  • 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. Feb 10, 2012 at 7:44
  • That's Fireworks, not Photoshop. Feb 10, 2012 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. Feb 10, 2012 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. Feb 10, 2012 at 19:12
  • Thanks, it definitely helps to know I can use FW to read it correctly.
    – Gaia
    Feb 11, 2012 at 14:25
5

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.

4

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.

0

I have this same issue, weird thing, at work i can open the file just fine and it shows transparency At home i get some green hue and its opaque??? Im running crazy... same file, same photoshop versions, both open it differently?!?! Preview on OSX handles file just fine, thats even weirder. SO i copy pasted between Preview and Photoshop to get it looking properly in Photoshop and make new export. Im using Photoshop since version 3, never bumped into this before. Still learn each day ;)

-2

You can usually OPEN transparent PNGs, but you can't copy/paste. Try saving it and opening it from within photoshop.

1
  • 1
    Check the accepted answer, yours doesn't explain why. Read How to Answer to learn more about the site.
    – Luciano
    Mar 29, 2019 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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