• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Transparent colors missing

New Here ,
Aug 15, 2024 Aug 15, 2024

Copy link to clipboard

Copied

I'm working with images that must have transpaency for certain parts. Here is my flow:

 

  1. Open an image
  2. Turn background to a layer
  3. Duplicate layer
  4. Remove background on top layer
  5. Set bottom layer to 0% opacity (so 100% transparent)

 

The result should be that when I do the eyedropper on a part of the image that is 100% transparent, I should get the RBG channels for the color, but it should just be transparent. The eyedropper doesn't detect any color.

 

I also have the problem that if I save the image as PNG, preserving transparency, all the RBG information is lost and the transparent pixels are just set to #FFFFFFFF (so 100% transparent white). The only way I can preserve the RBG information is to set the opacity of the bottom layer to 1%. Of course, that means there is a shadow of the background everywhere in the image.

 

Can someone explain why Photoshop is doing this? How can I get it to preserve the RBG information no matter the alpha channel (opacity)? This feels very much like a bug, but hopefully there is just a setting somewhere that I can adjust.

 

I'm doing this via a script, but even when doing it by hand, I get the same result.

 
Bug Unresolved
TOPICS
Actions and scripting , Windows

Views

157

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
8 Comments
Community Expert ,
Aug 15, 2024 Aug 15, 2024

Copy link to clipboard

Copied

I was wondering this years ago. One of the engineers who posted a lot here then said that a fully transparent pixel has NO color, and when opacity is added, it uses the Background Color.

 

I was using the Filter Foundry plug-in, which can directly manipulate Transparency, and was trying to do an "un-erase"filter, but everything came back in the Background color.

Votes

Translate

Translate

Report

Report
New Here ,
Aug 15, 2024 Aug 15, 2024

Copy link to clipboard

Copied

Well, that engineer is wrong. A fully transparent pixel has 4 layers: R G B and A. If it is fully transparent, A is set to 255, but that doesn't mean that R G or B is `null`. In fact, R G and B would have to be some number between 0 and 255 because there is literally no `null` value available to set. So, every 100% transparent pixel must also have a color. It is literally impossible to have a transparent pixel without color (unless the image only has a single channel: A).

 

As to your comment about the Filter Fountry plug-in, some on my team use GIMP with its anti-erase function, which does the same thing; that is actually how I found out that Photoshop is doing it wrong. In GIMP anti-erase isn't paying attention to the background color, it is using the color set in the pixel, both for anti-erase and for the eyedropper. Photoshop is setting the pixel color of any 100% transparent pixel to white (#FFFFFF).

 

Votes

Translate

Translate

Report

Report
LEGEND ,
Aug 15, 2024 Aug 15, 2024

Copy link to clipboard

Copied

An *RGB* image will have three channels plus the composite, and you can add an alpha channel. An L*A*B image has Lightness, A, and B channels. CMYK has four. And so on. In Photoshop, there is no alpha channel (show the channels palette to see this.) Nor its there a saved alpha channel in the PNG file

I'm not sure why you think that invisible RGB data would be saved? You would need the entire layer plus a transparent alpha channel in the saved PNG.

Votes

Translate

Translate

Report

Report
New Here ,
Aug 16, 2024 Aug 16, 2024

Copy link to clipboard

Copied

I think that because the spec for PNG images says the format supports the following color spaces: RGB, RGBA, K, KA, (and tRNS as well, but that's out of scope here). These can be encoded with 1, 2, 4, 8, or 16 bits per channel. So, if PNG can support that, and Photoshop can export to PNG, I would expect that internally, even if Photoshop is storing the image in LAB or CMYK, it would have to convert to RGB to get a proper PNG, so color would have to be there, even in transparent images.

 

Having said all that, I can see that there are 4 channels in my images: R, G, B, and A. So even my working image in the PSD file has a color for each 100% transparent pixel and I can get the color back by changing only the alpha channel, so it isn't internally removing it and it is there in the PSD file; it just isn't exporting it to the PNG correctly. This is either a bug or a configuration problem. If a configuration problem I'd love to know about it, if a bug, I'm reporting it.

 

For references about there actually being an alpha channel saved to the PNG file, see:

 

Votes

Translate

Translate

Report

Report
LEGEND ,
Aug 16, 2024 Aug 16, 2024

Copy link to clipboard

Copied

There is only an alpha channel if you add one. And Photoshop supports multiple alpha channels. PNG only supports one.

In general, a flattened image will discard all non-visible data. I would not expect a PNG to save hidden RGB values. It just doesn't work this way. Can you find any other graphics apps that do what you want? I'm guessing not.

Votes

Translate

Translate

Report

Report
LEGEND ,
Aug 16, 2024 Aug 16, 2024

Copy link to clipboard

Copied

Half of layer 1 is black and half white. Half of layer 2 is red, covering the black pixels on layer 1 completely. I clear the white and save to PNG. How would I save the black info from layer 1? Without layer support, its not possible. You can't mask both in and out some pixels with an alpha channel. The black is discarded and can't be recovered.

Votes

Translate

Translate

Report

Report
New Here ,
Aug 16, 2024 Aug 16, 2024

Copy link to clipboard

Copied

Because of there being no way to upload files in replies here, I'm creating this to upload files for a reply to this: Transparent colors missing - Adobe Community - 14802062

 

Votes

Translate

Translate

Report

Report
New Here ,
Aug 16, 2024 Aug 16, 2024

Copy link to clipboard

Copied

LATEST

PIL supports that saving values in all 4 channels, actually so does every other graphics program, because that is the only way to write out a RGBA PNG file. The question is: what do they write? Photoshop does it wrong.

 

 

from PIL import Image
img = Image.new("RGBA", (300, 300), (255, 0, 0, 0))
img.save("red_image.png")

 

 

You may need to `pip install pillow` before running that code.

 

You state that "a flattened image will discard all non-visible data", which is fine, but if I flatten an image that has 4 channels, then "non-visible" is an interesting concept because I should be flatting all the red channels together, all the blue channels together, all the green channels together and all the alpha channels together, because each layer should have its own set of channels. This would mean that if I later hide all channels but red, for example, I'd see the data that was in all the other red channels flattened together. It shouldn't throw away data in red channels that also had an alpha channel in that layer that was set to 100%.

 

Photoshop handles channels and flattening layers very poorly IMO. The channels visible to me aren't per layer, and they include the alpha blended in even when there is a separate alpha channel. Note my attachment. You'll see that the red channel is missing lots of data, even the layer that is set to 50% transparent. Then you'll note that I've erased some of the alpha channel, which should have caused the entire image to be more transpaent where I erased it, but that didn't happen.

 

Now, to prevent any discussion about how that isn't how it works, that's my point: it is broken. If I try to draw a black line in an RGB color space, 3 channels get modified. If I draw that same black line in an RGBA color space with a 50% transparent stroke, 4 channels should get modified. Since Photoshop doesn't support drawing a line like that, you have to change the opacity of the entire layer, but that never affects the alpha channel, it only affects the RGB channels (and apparently some hidden alpha channel). You can even try it with a text object; it doesn't matter what you do to the alpha channel itself, the opactiy of the text layer doesn't change.

 

Side note: GIMP supports a brush with an RGBA color set, but if A is 0, then it doesn't paint the color, so it is broken too, but it does other things much better.

 

So, another test. You assert that you can't store the data the way I propose. Have a look at the image I've attached. Open it in Photoshop and use an eyedropper to tell me what color it is. Then, open it in GIMP and tell me what color it is. Then tell me what color you see.

 

Photoshop (no color detected)

GIMP (red)

Your eyes (transparent)

Reality (every pixel is #FF000000)

 

How can I reproduce that image using Photoshop? That is the bug, because I can absolutely reprouce it in a PSD file, but not in a PNG file. In fact, you can't even export that PSD file as a PNG in Photoshop.

 

Side note: In a PSD file the eyedropper is still broken in Photoshop by reporting nothing for a red image. It is actually pretty funny to see the eyedropper detect no color when I look at the layer and see it filled with red 🙂

 

Due to limitations on this forum, please find the attachments here: Transparent colors missing (files 1) - Adobe Community - 14804902

 

Votes

Translate

Translate

Report

Report