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...
Better resize
Moderators: XnTriq, helmut, xnview
-
- Author of XnView
- Posts: 44747
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
Re: Better resize
Lanczos3 is available in XnView/NConvert, so i can add it easily in GFL SDK & GFLAx.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...
Could you send me a sample (resize and not) from ASPImage?
Pierre.
-
- Posts: 16
- Joined: Wed Sep 21, 2005 9:30 am
- Location: Denmark
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
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
-
- Posts: 16
- Joined: Wed Sep 21, 2005 9:30 am
- Location: Denmark
-
- Author of XnView
- Posts: 44747
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
-
- Posts: 16
- Joined: Wed Sep 21, 2005 9:30 am
- Location: Denmark
-
- Author of XnView
- Posts: 44747
- Joined: Mon Oct 13, 2003 7:31 am
- Location: France
-
- Posts: 16
- Joined: Wed Sep 21, 2005 9:30 am
- Location: Denmark
-
- Posts: 26
- Joined: Wed Mar 09, 2005 7:44 pm
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.
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.
-
- Posts: 8705
- Joined: Sun Oct 12, 2003 6:47 pm
- Location: Frankfurt, Germany
Thank you for that good info. It might be also worth while looking at FAQ "How to resize images with text (screenshots)"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.
-
- Posts: 16
- Joined: Wed Sep 21, 2005 9:30 am
- Location: Denmark
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:
(where "objImage" is a GFLAx image you've loaded)
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);
}
GFL_RESIZE_LANCZOS
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?