Why does resizing PNG with alpha transparency make edges gray?

I’m using PSP 7 (I know it’s old, but it serves my purposes).

I am resizing a bunch of images. PNG images with alpha transparency load with black backgrounds when I first open them. I have little experience with masks. I learned that I can do Masks > Load From Alpha Channel to see the transparent areas.

After loading the alpha channel, I resize the image. Usually, this works fine. However, sometimes the edges look a bit gray – kind of like if I made a transparent GIF on a gray background.

For the record, the box for Resize all layers is checked. If I uncheck that, the edges are black after resize. Also, the original images are already PNG-24 (16 million colors).

Here is the original viewed at 8x zoom (scaled in the browser to fit):

enter image description here

And here it is after reszing viewed at 8x zoom:

enter image description here

And here is the resized image viewed at 1x zoom:

enter image description here

It’s probably not that noticeable to a lot of people, but the top edge does not look smooth to me.

Is there an easy way to fix this? Do I need to resize the mask separately?

The last one I had like this was a white circle. So I just cropped out the edges and added a white circle behind it. This one is a little harder.


I think what Scott says in his comment is indeed what’s happening.

A guess… the alpha channel and the image are being anti-aliased differently. The green is not masked by the alpha channel, but rather aligns with it. When you scale, the alignment is thrown off.

Here’s how I fixed it.

1) Before loading the mask from the alpha channel, select the green area. Expand the selection (I expanded by 2 pixels). Here’s the image at 4x zoom, showing the selection.

enter image description here

2) Using the same green color, flood fill the black area that’s within the selection. Load mask from alpha channel and resize image. Here’s the resized image at 8x zoom. Notice the lack of gray pixels.

enter image description here

Here is the final image at 1x zoom.

enter image description here

Here is the original for comparison.

enter image description here

The difference is subtle, but I think the new one is visibly smoother than the original.

Source : Link , Question Author : toxalot , Answer Author : toxalot

Leave a Comment