Image resize ignores alpha transparency!?

Corel Paint Shop Pro

Moderator: Kathy_9

Post Reply
krilbe
Posts: 17
Joined: Tue Feb 03, 2015 9:25 am
operating_system: Windows 7 Ultimate
System_Drive: C
32bit or 64bit: 64 Bit

Image resize ignores alpha transparency!?

Post by krilbe »

I just tried PSP X7.1 to resize a PNG with alpha channel transparency. It seem to do something wrong. Pixels near an anti aliased edge between an opaque area and a transparent area gets tainted with w white halo.

The opaque area has a uniform grey color but the partially transparent pixels along the edge receive a lighter color value (as well as an appropriate partial transparency). The more transparent, the lighter the color placed there.

It looks as if the resampler considers 100 % transparent pixels to have white color and opaqueness 0 % rather than "no color" and 0 % opaqueness. If this is the case, it HAS to be a bug.

Can anyone confirm or tell me how to get this resize done right?
rosekatula
Posts: 1
Joined: Tue Feb 03, 2015 1:04 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit
Location: Durban, South Africa
Contact:

Re: Image resize ignores alpha transparency!?

Post by rosekatula »

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.

before attempting to resize is go to Image > Mode > RGB Color
Code, design & develop. Its like winning the lottery jackpot
Simone Corel UK
Alludo
Posts: 391
Joined: Sun Feb 28, 2010 6:59 am
operating_system: Windows 8
System_Drive: C
32bit or 64bit: 64 Bit
Location: UK, Wiltshire

Re: Image resize ignores alpha transparency!?

Post by Simone Corel UK »

Hi krilbe

Your sample file that you sent had no Alpha channel. Your issue is a anti-alias change.
I work for the Corel UK Support. I will not give technical support through this forum and my answer is only related to this thread.
krilbe
Posts: 17
Joined: Tue Feb 03, 2015 9:25 am
operating_system: Windows 7 Ultimate
System_Drive: C
32bit or 64bit: 64 Bit

Re: Image resize ignores alpha transparency!?

Post by krilbe »

Hi,

The image is already RGB.

Bring up this URL for ref:
http://www.rilbe.se/BugDemo/Test.html

Each row of images shows, from left to right:
Image reduced in size using PSP X7.1 resample (SmartSize).
[MIDDLE] Image exported directly to PNG from CorelDRAW X7 in the final size.
Image reduced in size using www.pixlr.com.

For
and
the same source file is used: a PNG exported from CorelDRAW, from the same design as [MIDDLE], but exported in much higher resolution and then downsized in PSP or Pixlr respectively. All CorelDRAW exports are made with RGB color, transparency and anti-alias.

At the bottom is a zoomed-in screen dump of this same web page, where the artefacts are easier to see.

It is not so obvious for the top row of red circles, but for the other two rows the
image produced by PSP displays a very distinct white halo around the edges of the gray areas. This halo is NOT produced when doing the exact same resize in Pixlr, see
images.

I hope we can all agree that the PSP images stand out as incorrect - there should not be a white halo.
krilbe
Posts: 17
Joined: Tue Feb 03, 2015 9:25 am
operating_system: Windows 7 Ultimate
System_Drive: C
32bit or 64bit: 64 Bit

Re: Image resize ignores alpha transparency!?

Post by krilbe »

Simone Corel UK wrote:Hi krilbe

Your sample file that you sent had no Alpha channel. Your issue is a anti-alias change.
Well, all I can say is that the image I sent does come up in PSP X7.1 with pixels that have opacity ranging from 0 to 255. I don't really care if you call it "alpha channel" or "Pinocchio" or whatever, but the data that should be used as alpha channel transparency IS present in the file and PSP does use this data to display partially transparent pixels. it also uses this data to correctly calculate transparency in a resampled (downsized) image, but it does something wrong with the RGB values.
DPainter
Posts: 92
Joined: Mon Dec 10, 2012 2:04 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte
processor: Intel i7-7700 3.6GHz Quad core 8
ram: 16GB
Video Card: nVidia GTX 1070
Hard_Drive_Capacity: 2T HDD
Monitor/Display Make & Model: 2 X SAMSUNG/s
Corel programs: Paintshop Pro 2019 Ultimate.

Re: Image resize ignores alpha transparency!?

Post by DPainter »

krilbe wrote:
Simone Corel UK wrote:Hi krilbe

Your sample file that you sent had no Alpha channel. Your issue is a anti-alias change.
Well, all I can say is that the image I sent does come up in PSP X7.1 with pixels that have opacity ranging from 0 to 255. I don't really care if you call it "alpha channel" or "Pinocchio" or whatever, but the data that should be used as alpha channel transparency IS present in the file and PSP does use this data to display partially transparent pixels. it also uses this data to correctly calculate transparency in a resampled (downsized) image, but it does something wrong with the RGB values.
I agree. I don't use X7 much anymore but I had noted the grey tinge around resized, down sized images with transparent background. png, psd, pspimage not vector. all showed this high water mark after down sizing. No alpha on these images. I use the "Smart Size" setting the most. It seams to size the pixel and retain anti-alias better when down sizing. Up sizing? If it's not a vector, I avoid like a plaque. Not even Photoshop dose this well.
Simone is correct to say it's not the alpha channel your seeing. You don't see the alpha channel at all in a image that has one in psp. But that said, X7 has a fault in this area that X6 dose not. The only tool that creates this shadowing effect in other psp versions that I know of is the Sharpen tool. It works by trying to black out the more opaque pixels to remove blurring but creates a shadow instead. This is what appears to be happening now to X7's down sizing anti-alias.
Simone Corel UK
Alludo
Posts: 391
Joined: Sun Feb 28, 2010 6:59 am
operating_system: Windows 8
System_Drive: C
32bit or 64bit: 64 Bit
Location: UK, Wiltshire

Re: Image resize ignores alpha transparency!?

Post by Simone Corel UK »

Hi to both, I keep your comments in mind.
I work for the Corel UK Support. I will not give technical support through this forum and my answer is only related to this thread.
krilbe
Posts: 17
Joined: Tue Feb 03, 2015 9:25 am
operating_system: Windows 7 Ultimate
System_Drive: C
32bit or 64bit: 64 Bit

Re: Image resize ignores alpha transparency!?

Post by krilbe »

I've tried all the resample options, including all sharpen level settings from min (Smoother = 0) to max (Sharper = 100). They all produce a white halo except the "Pixel Resize", but that's no surprise because the "Pixel Resize" just copies (some of the) pixels. I've added all the samples to the bottom of the demo web page:
http://www.rilbe.se/BugDemo/Test.html

As you can see, the sharpening that can be applied in the Bicubic resample method has no effect on the halo; it just adds a darker edge INSIDE the halo. You can also see that all resample methods that actually calculate new pixels based on neighbouring old pixels in any way suffer from the halo effect. The only method that simply picks some of the old pixels as they are (Pixel resize) is also the only method that does not produce a halo (how could it?).

If I put a background raster layer with this green color behind the original high-res PNG, and then resize the image, the halo effect remains, because PSP resamples each layer separately. But if I flatten the image before resize, the halo effect disappears, because there are no partially transparent pixels anymore.

In essence, this buggy resampler in PSP X7.1 makes it totally useless for the probably rather common use case to resize a PNG with partial ("alpha channel") transparency for use on a web page. The halo effect is too ugly. And no matter what you call the partial transparency data inside a PNG file ("alpha channel" or anything else), the fact remains that the resampler calculates incorrect RGB values for pixels in partially transparent areas.
krilbe
Posts: 17
Joined: Tue Feb 03, 2015 9:25 am
operating_system: Windows 7 Ultimate
System_Drive: C
32bit or 64bit: 64 Bit

Re: Image resize ignores alpha transparency!?

Post by krilbe »

I have now found the simple and true cause of the halo.

Using GIMP I've been able to see that CorelDRAW X5 (X6 and X7 too?) exports "empty" pixels as 0 % opaque as it should, but it sets the RGB value to (255, 255, 255) = white rather than (0, 0, 0) = black. So, CorelDRAW exports empty areas as 0 % opaque white, rather than 0 % opaque black.

Although this is probably a bit unorthodox, I assume it's not really incorrect. I would expect PaintShop Pro to handle it correctly, but it doesn't. It weighs in this "whiteness" when calculating the RGB values for the new resized edge pixels, causing the halo that I've demonstrated.

I hope that Corel will finally accept that this is really a bug in one of their products. Two possible cases:

1. If the PNG standard defines that fully transparent pixels should always have RGB = (0, 0, 0), then CorelDRAW has a bug in its PNG export.

2. If the PNG says nothing about the RGB value for fully transparent pixels, then PaintShop Pro X7 has a bug in its resize function (it assumes that the RGB is (0, 0, 0) for fully transparent pixels, which may actually not be the case, and in those cases produces a halo).

Regards,
Kjell Rilbe
Simone Corel UK
Alludo
Posts: 391
Joined: Sun Feb 28, 2010 6:59 am
operating_system: Windows 8
System_Drive: C
32bit or 64bit: 64 Bit
Location: UK, Wiltshire

Re: Image resize ignores alpha transparency!?

Post by Simone Corel UK »

@krilbe

I just ran a test in Photoshop and it doesn't show any color in a transparent pixel, neither white nor black.
I work for the Corel UK Support. I will not give technical support through this forum and my answer is only related to this thread.
krilbe
Posts: 17
Joined: Tue Feb 03, 2015 9:25 am
operating_system: Windows 7 Ultimate
System_Drive: C
32bit or 64bit: 64 Bit

Re: Image resize ignores alpha transparency!?

Post by krilbe »

Simone Corel UK wrote:@krilbe

I just ran a test in Photoshop and it doesn't show any color in a transparent pixel, neither white nor black.
In that case, Photoshop doesn't show the data that's there. Try GIMP. Also, see my other post from today in this same forum. It contains detailed steps to demonstrate the bug, with no connection to CorelDRAW or other software. Everything is native PSP and clearly yields incorrect results.
Post Reply