PHOTOSHOP - Resizing object with partial opacity gives results I don't expect

  • 1
  • Problem
  • Updated 3 years ago
  • (Edited)
I've had some problems reporting a bug to Corel in their product PaintShop Pro X7, partially because they keep using your Photoshop as a definition of what's right. Unfortunately Photoshop has the same problem...

This is about Photoshop CC 2015, just downloaded.

The bug is that when resizing an image that has different opacity in different pixels/areas, and those areas also have different color (RGB value).

Steps to reproduce:

1. New image, 100x100 px with transparent background.

2. Fill entire image with RGB = (255, 0, 0) with 1 % opacity, i.e. almost-transparent fully saturated red. This "thin" color should be difficult to see.

3. Draw a solid blue circle in the middle, 70 px in dameter. Use color RGB = (0, 0, 255) and 100 % opacity. You can use the brush tool with hardness 100 % for this.

4. Resize the image to 20x20 px using bicubic.

5. Using the dropper tool, inspect the pixels around the circle's edges. You will find that those that are most transparent will have an almost magenta color. This will appear as a magenta halo around the circle when placed on e.g. white background. To see this better, add a new layer behind the original one, and make it solid white.

Doing the same test in Corel's PaintShop Pro gives similar results, but slightly worse. GIMP does NOT produce such a halo, and according to someone I discussed it with, Paint.Net doesn't either. This means that it is quite possible to do the resize without creating that halo, and I have a pretty clear idea how.

Before submitting the old pixels' RGB values to the resize/resample algorithm, each pixel's RGB value should be weighted with its opacity. That should solve it in full.

Here's the resulting image that demonstrates the problem:


And here is the same image zoomed in to see the halo properly:
Photo of Kjell Rilbe

Kjell Rilbe

  • 4 Posts
  • 0 Reply Likes

Posted 3 years ago

  • 1
Photo of Kjell Rilbe

Kjell Rilbe

  • 4 Posts
  • 0 Reply Likes
Consider ANY image with varying opacity and non-uniform color. Any resampling size change performed on that kind of image will result in too much color being applied from the low-opacity pixels when mixed with higher-opacity pixels. For example, a grey circle on a background with 1 % opaque red will cause a red halo around the grey circle.

Adobe obviously knows this, because they have actually implemented a special case for pixels that are 0 % opaque: Any color present in such a pixel is ignored, or in other words weighted with zero. But if the opacity is minimally changed to 1 (on a 0-255 scale), it's RGB value is suddenly weighted just as much as a fully opaque pixel.

THIS IS WRONG!

(I also wonder why PS changes the RGB of the transparent pixels of the bounding box to the fg color used when drawing a circle. Not that it matters really, since they are transparent. It just seems like unnecessary extra work...)