Info about Resampling algorithms

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, helmut, xnview

thire
Posts: 118
Joined: Sat Jul 30, 2005 10:26 am

Info about Resampling algorithms

Post by thire »

When I change the size of an image, in XnView there are serveral possibilities (algorithms) to do that:
*next neigbour
*bilinear
*gauss
*hermite
*bell
*bspline
*michell
*lanczos
I wonder when to use which and how they act!
There is a discussion in the german wikipedia goning on at http://de.wikipedia.org/wiki/Wikipedia_ ... ochrechnen about this. Can anybody help?
Thomas
User avatar
xnview
Author of XnView
Posts: 44917
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: info about algorithms

Post by xnview »

thire wrote:When I change the size of an image, in XnView there are serveral possibilities (algorithms) to do that:
*next neigbour
*bilinear
*gauss
*hermite
*bell
*bspline
*michell
*lanczos
I wonder when to use which and how they act!
There is a discussion in the german wikipedia goning on at http://de.wikipedia.org/wiki/Wikipedia_ ... ochrechnen about this. Can anybody help?
It's only different interpolation method between 2 pixels.
Pierre.
thire
Posts: 118
Joined: Sat Jul 30, 2005 10:26 am

Post by thire »

Yes, I imagine, but where can I get closer info.
a) about the algorithms themselfs
b) about when to use which method? (speed, quality, special situation)
User avatar
Olivier_G
XnThusiast
Posts: 1423
Joined: Thu Dec 23, 2004 7:17 pm
Location: Paris, France

Post by Olivier_G »

Have a look at this PDF file, with explanations and illustrations for some of them.
Some more advanced techniques are compared here: http://www.americaswonderlands.com/digi ... lation.htm

Usually:
- when speed is an issue, bilinear gives good results (nearest neighbour is the fastest, but really ugly for most uses)
- for quality work, lanczos and bicubic are often recommended

Olivier
thire
Posts: 118
Joined: Sat Jul 30, 2005 10:26 am

Post by thire »

ool. thanks.
I will have a loser look at the pdf. :)
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Post by Drahken »

Take a fairly small image and increase it's size by 300% using each of the different methods, compare the results. That is the only real way to get an understanding of the differences between the algorithms. You will find 3 main differences between the results: speed, detail, blurriness. In general, the closer they are to the top of the list, the faster and uglier they will be. The closer they are to the bottom of the list, the slower, better, but blurrier they will be. (Note that blurry isn't always bad. You will often find that if you use a blurrier algorithm and then sharpen the result, you will have a better image than if you used a less blurry algorithm.)

Some rules of thumb:
Mitchell is generally the best one to use, I find that it gives the best results in most cases, and rarely needs sharpening afterward.
Lanzcos will usually result in slightly better quality than mitchell, but will be quite blurry and will look bad unless you sharpen it quite a bit.
If you have a slow computer, bilinear is probably your best choice.
If you're resizing a GIF file, use next neighbor. Any other filter will change it to a 24bit image, and will wreck any transparency.

While we're on the subject, is there any chance of getting the Wiener filter added to xnview? It's a slow algorithm, but it gets great results on most images.
Last edited by Drahken on Fri Sep 16, 2005 1:15 pm, edited 1 time in total.
thire
Posts: 118
Joined: Sat Jul 30, 2005 10:26 am

Post by thire »

cool, thank you. I will try something out as well! :)
And I just use it for resizing (or resampling?!) jepg-images.
Thomas
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

Perhaps worth while writing an FAQ. Forum member "Lasse" has tested the resizing of screenshots using various resampling algorithms of XnView. He provides the results on his webpage.

See also topic FAQ "How to resize images with text (screenshots)".
rjbgbo

Image for impress

Post by rjbgbo »

For quality impression which is the indication.

*next neigbour
*bilinear
*gauss
*hermite
*bell
*bspline
*michell
*lanczos

Thank for the attention.
jokoon
Posts: 3
Joined: Sat Mar 17, 2007 1:32 pm

Post by jokoon »

Sorry for unearthing the topic, just a fast question ...
Is Bspline the bicubic algorithm ?
User avatar
Troken
Posts: 698
Joined: Thu Feb 09, 2006 10:18 am
Location: Sweden

Post by Troken »

I wonder if they are all needed? Seriously, how many are using most of the methods? Imo its more confusing than contributing, wouldn't it be a good idea to take some of them away?

For me these would be more than enough (and still more that photoshops three):
- next neighbour
- bilinear
- bspline (or bicubic?)
- mitchell
- lanchos
User avatar
foxyshadis
Posts: 394
Joined: Sat Nov 18, 2006 8:57 am

Post by foxyshadis »

Mitchell is bicubic.

Agreed that some of the resizers aren't very useful. Could be worse, could be the full list of imagemagick resizers. :p Gauss, bell, and bspline are almost indistiguishable, and often only useful as specialized effects, not generic outputs; in general they're too close to bilinear to even matter. There are a wide range of bsplines but this one doesn't retain much sharpness. Hermite is practically indistiguishable from Mitchell - in fact it's one of the degenerate cases of the Mitchell/Netravali filter, iirc. Those who actually care about these others would probably also care enough to want their tunable parameters as well, or more advanced non-separable resize kernels.

So point, bilinear, bicubic, and lanczos would seem to be enough for anyone using batch resize. If you wanted to emulate photoshop, you could have a bicubic smoother (lower "c") like photoshop, to fill that halfway point in.
User avatar
Troken
Posts: 698
Joined: Thu Feb 09, 2006 10:18 am
Location: Sweden

Post by Troken »

Nearest neighbour is very important too, for ie enlarging gifs or screen dumps.
User avatar
foxyshadis
Posts: 394
Joined: Sat Nov 18, 2006 8:57 am

Post by foxyshadis »

Oh, sorry. Point, box, and nearest neighbor are (usually) synonyms for the same thing, so I have a bad habit of mixing names up. :p
jokoon
Posts: 3
Joined: Sat Mar 17, 2007 1:32 pm

Post by jokoon »

Thanks :)
It was just to be sure paint.net has not anything special about resizing algorithms.