Page 1 of 1

Better resize

Posted: Tue Sep 27, 2005 11:20 am
by mindplay
I'm using GFLAx in ASP.

I am not happy with the image quality when resizing images to very small sizes (e.g. thumbnails) ... I've had to migrate from ServerObjects ASPImage v2.0, which unfortunately is unstable and causes server death. But the thumbnail quality was considerably better - my thumbnails with GFLAx are too blurred.

I'm guessing the Resize function uses a straightforward bicubic resampling algorithm?

I've been trying to improve upon the quality, by gradually resizing to half the size of the source image, after doing an EnhanceDetail() ... this works better, but still not nearly as good as in ASPImage, and considerably slower.

Is there any hope of seeing something like e.g. Lanczos3 interpolation implemented in the future?

see this source code ...

Lanczos3, to my knowledge, is the best non-proprietary, high-quality image resampling algorithm available - it is also one of the fastest; not considerably slower than regular bicubic interpolation. It also seems to be what high-end graphics programs use, e.g. Photoshop...

Re: Better resize

Posted: Tue Sep 27, 2005 2:04 pm
by xnview
mindplay wrote:I'm using GFLAx in ASP.

I am not happy with the image quality when resizing images to very small sizes (e.g. thumbnails) ... I've had to migrate from ServerObjects ASPImage v2.0, which unfortunately is unstable and causes server death. But the thumbnail quality was considerably better - my thumbnails with GFLAx are too blurred.

I'm guessing the Resize function uses a straightforward bicubic resampling algorithm?

I've been trying to improve upon the quality, by gradually resizing to half the size of the source image, after doing an EnhanceDetail() ... this works better, but still not nearly as good as in ASPImage, and considerably slower.

Is there any hope of seeing something like e.g. Lanczos3 interpolation implemented in the future?

see this source code ...

Lanczos3, to my knowledge, is the best non-proprietary, high-quality image resampling algorithm available - it is also one of the fastest; not considerably slower than regular bicubic interpolation. It also seems to be what high-end graphics programs use, e.g. Photoshop...
Lanczos3 is available in XnView/NConvert, so i can add it easily in GFL SDK & GFLAx.
Could you send me a sample (resize and not) from ASPImage?

Posted: Tue Sep 27, 2005 2:51 pm
by mindplay
here is a quick test, including the source picture for the thumbnails.

this may be a somewhat subjective matter, but if you look closely, I think you will see that the straight GFLAx.Resize is somewhat blurred and less detailed than the other two...

here's another idea: a designated "thumbnail" function might be useful - I could write one myself in ASP of course, like I already did, but a built-in function would be useful to everyone not using ASP ... this function probably shouldn't work like mine, which iterates by calling EnhanceDetail and scaling down to 60% of the image size repeatedly. A better function would be one that sharpens the original image with an appropriate radius and strength, then resizes with Lanczos3 algorithm to obtain a more detailed thumbnail.

Just an idea :)

Posted: Mon Dec 05, 2005 2:34 pm
by mindplay
Are you adding Lanczos3 then?

just wondering :)

Posted: Wed Dec 07, 2005 8:15 pm
by xnview
mindplay wrote:Are you adding Lanczos3 then?

just wondering :)
You have it in GFL SDK 2.40

Posted: Thu Dec 08, 2005 8:31 am
by mindplay
on september 27, you said you were going to add it - but the last release (v2.40) is dated july 5th.

so the feature was already there? it's not documented - how does it work?

Posted: Thu Dec 08, 2005 10:26 am
by xnview
mindplay wrote:on september 27, you said you were going to add it - but the last release (v2.40) is dated july 5th.

so the feature was already there? it's not documented - how does it work?
Houps sorry, not in 2.40 but in next release...

Posted: Thu Dec 08, 2005 10:34 am
by mindplay
i'll be on the lookout for that, then - thanks :)

Posted: Fri Dec 16, 2005 10:26 pm
by b.e.wilson
Just a late observation: ALL resizing to a smaller image results in blurred-looking images. Only applications that sharpen after every resize (and only the most dumbed-down versions would do that automatically) result in a good loking thumbnail.

If you make a thumbnail, sharpen gently afterwards.

In the image processing game there are a few rules about sharpening:

Only sharpen once to get the final image.
Sharpen after a resize to a smaller image.
If you suspect you've oversharpened, you have in reality WAY oversharpened.
Haloes only belong around the heads of angels and saints, not everything in your image.

Posted: Sat Dec 17, 2005 10:01 am
by helmut
b.e.wilson wrote:Just a late observation: ALL resizing to a smaller image results in blurred-looking images. Only applications that sharpen after every resize (and only the most dumbed-down versions would do that automatically) result in a good loking thumbnail.

If you make a thumbnail, sharpen gently afterwards.

In the image processing game there are a few rules about sharpening:

Only sharpen once to get the final image.
Sharpen after a resize to a smaller image.
If you suspect you've oversharpened, you have in reality WAY oversharpened.
Haloes only belong around the heads of angels and saints, not everything in your image.
Thank you for that good info. :-) It might be also worth while looking at FAQ "How to resize images with text (screenshots)"

Posted: Mon Dec 19, 2005 8:46 am
by mindplay
I guess it's a matter of preference, but I find I get better results if I sharpen a little more, then resize - not the other way around. For thumbnails, I use the following code to scale down the image by two thirds at a time, then sharpening:

Code: Select all

	function ratio (newWidth, newHeight) {
		return (newWidth * newHeight) / (this.objImage.Width * this.objImage.Height);
	}


	function ResizeR (newWidth, newHeight) {
		while (ratio(newWidth, newHeight) < 0.5) {
			objImage.EnhanceDetail();
			objImage.Resize(Math.round(objImage.Width*0.66), Math.round(objImage.Height*0.66));
		}
		if (ratio(newWidth, newHeight) < 0.75)
			objImage.EnhanceDetail();
		objImage.Resize(newWidth, newHeight);
	}
(where "objImage" is a GFLAx image you've loaded)

GFL_RESIZE_LANCZOS

Posted: Mon Sep 04, 2006 12:46 pm
by linojr
I've been trying to get it to work but I do not see any diference between lanczos and quick. Has it been added to version 2.54? :shock: