PHOTOSHOP - PNG transparent (Opacity= 0) pixels undefined RGB values

  • 3
  • Problem
  • Updated 3 years ago
  • Not a Problem
  • (Edited)
Transparent pixels get undefined RGB values when saving as transparent PNG.
Photo of Oriol Ferrer Mesià

Oriol Ferrer Mesià

  • 2 Posts
  • 0 Reply Likes

Posted 3 years ago

  • 3
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 765 Reply Likes
Yes, because the value of completely transparent colors is undefined, but many users do not want them all set to a solid color (preserve what is there). It looks like you did some blurring or other operation that caused the colors to spread out (preventing undefined colors from being filtered into visible areas).

Not sure where you got the white border from.
Photo of Oriol Ferrer Mesià

Oriol Ferrer Mesià

  • 2 Posts
  • 0 Reply Likes
the white values are replaced when you save. If the alpha values are 0, photoshop replaces the RGB values, I am guessing to save space. You can see how this doesn't happen if you set the alpha 1, almost transparent but RGB still partly visible.

This is fine for most uses, but when doing computer graphics that use those PNG as sources for textures that will be mip-maped, you get white halos around them. That happens because when the that PNG is drawn at a smaller scale, a downsampled version of the PNG is used, and when downscaling the PNG, its RGB values are blended with the values from their neighbors. If the neighbors have been artificially set to white, the downscaled version of the PNG then somehow shows that, spoiling the values around the edges (where alpha is 0).

I know I can make this work by using "real" alpha channels in Photoshop, but its quite inconvenient.

I just wish there was a way to disable this "optimization" that Photoshop applies when saving PNGs... I feel there should be a way to maintain the true RGB values of the image.