resizing algorithms

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

Moderators: XnTriq, xnview

Post Reply
gazzawazza
Posts: 5
Joined: Wed Jul 08, 2009 10:26 am

resizing algorithms

Post by gazzawazza » Fri Aug 27, 2010 10:23 am

Good morning all.

I hope this is not a spurious question but I'm highly amateurish when it comes to taking / editing pictures... and I was curious about peoples' opinions regarding the various algorithms available when resizing/resampling.

My current task is a simple reduction of a 600 width photo down to 534. I have chosen to "Keep Ratio" and "Resample".

I know it's something of a subjective topic but I personally found Lanczos to deliver the best image reduction. I judged this mainly on the fact that the other algorithms seemed to lose sharpness, and Lanczos seemed to be closest to the original image's appearance.

I did do a bit of research before I posted here... and I generally saw bilinear and bicubic bandied around as well-known / recognised algorithms. Bilinear could be considered better for enlarging, because of its smoothing effect. Bicubic could be considered better for reduction, because of its sharpening effect.

I looked for Bicubic as an option in XnView and couldn't find it but then found a post stating that Mitchell was Bicubic. However, as already stated, Lanczos still seemed to provide greater levels of sharpening (on reduction) than Mitchell.

Am I doing something wrong?

What do people think?

Additionally, it also occurred to me that the 'performance' of an algorithm might be related to how large a resizing is being undertaken I.e. if you're dropping resolution by 2000px, perhaps one algorithm is 'better' than another?

Finally, it would be very interesting & instructive to hear opinion on the 9 algorithms available in XnView and when you use one, as compared to another.

Many thanks for any replies.



Gary

MaxSt
Posts: 133
Joined: Fri Apr 10, 2009 9:55 pm

Re: resizing algorithms

Post by MaxSt » Fri Aug 27, 2010 10:34 am

I think most of the resizing algorithms are written specifically for enlarging.

User avatar
JohnFredC
XnThusiast
Posts: 2010
Joined: Wed Mar 17, 2004 8:33 pm
Location: Sarasota Florida

Re: resizing algorithms

Post by JohnFredC » Fri Aug 27, 2010 2:59 pm

Lanczos does a very credible job, both for upsizing and downsizing. There may be small advantages to another algorithm on individual images, but the effort to test every single image is too large.
John


gazzawazza
Posts: 5
Joined: Wed Jul 08, 2009 10:26 am

Re: resizing algorithms

Post by gazzawazza » Sat Aug 28, 2010 6:46 pm

Thanks for all for responses + in particular XnTriq.

Your topic summary is excellent.

It's kinda reassuring that the general consensus appears to be Lanczos (as my testing indicated).

The odd comment regarding Mitchell performing better, in terms of retaining superior levels of sharpness (in comparison to Lanczos), left me puzzled though. It was visibly inferior in my downsizing testing (image, no writing). Having said this, most suggestions regarding resampling recommend Lanczos + sharpening (I.e. you will need sharpening to compensate for the anti-aliasing, which I simply didn't feel was necessary, in this instance).

Also, condensing the reading matter (for others looking for similar explanations), I should mention that some think Hanning is good for resizing images with text (http://newsgroup.xnview.com/viewtopic.p ... ing#p26846), although this independent test http://www.lassekolb.info/gim36_downsampling.htm, again, reckoned Lanczos was best (note: none were regarded as decent / satisfactory)! Please also note Hanning was NOT included in that test.

Therefore, I've done some testing of my own, downsizing a text-laden image. The image was a Vista 32bit Home Premium 'printscreen' job (i.e. a clipboard snapshot of whatever is on my desktop). There's loads of text, as my browser - FF 3.6.8 - is maximised with all the xnview topics I'm reading! The resolution is 1280x1042x24 (as reported by XnView). I reduced the image size to 75% of original (using v1.97.6) I.e. 960x768. My subjective conclusions are (based on quality + blur vs sharpness of the text) that:

- Lanczos provided the sharpest, most vividly coloured text ... and was noticeably sharper than the runners up.

- Bilinear, Mitchell, Hanning & Hermite were all very close together... in fact, too close to really decide whether one had an edge. However, text in the original image that was black, seemed more grey with these algorithms, whereas Lanczos seemed to be closer to the original font colour (although by no means perfect).

Comments:
- Although Lanczos was sharpest, I almost felt that some of the text lines were very slightly on the harsh side.

- The remaining 4 algorithms (I had tested all 9) were either simply poor quality, text-wise, or too blurred for my liking.

- Please note that I compared the resized images without saving, so that they weren't subject to any levels of compression. Naturally, all were viewed 1:1 zoom.

- I've only tested downsizing, so other algorithms might work better if one was upsizing.

When reading through my test & results, I just wondered whether I wasn't being ambitious enough (I hadn't dropped the resolution by much), so, as an additional comparison, I also tried reducing down to 50% of original size (I.e. down to 640x512). At this level, text was pretty damn small and anti-aliasing was king... but out of above top 5, now Bilinear seemed tolerably legible (it was the least blurred, although there was some inconsistency in the definition of the text). However, Lanczos had a good uniformity of colour-quality to the text, even if blurred. So, to compensate for the AA, I applied Sharpening +10 to each of the images. I'm inclined to think Bilinear made the text most easy (or least difficult :wink: ) to read, just due to being more 'liney' (very slightly sharper or perhaps less blurred) than the rest... but there really wasn't much in it... and I still think, in terms of image quality, Lanczos is difficult to beat (the colours seem a little more vivid).

Therefore, I know this is terribly subjective but for downsizing (with or without text), I'd dare to suggest Lanczos is an overall winner.

Any thoughts?



Gary

User avatar
XnTriq
Moderator & Librarian
Posts: 5424
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: resizing algorithms

Post by XnTriq » Sun Aug 29, 2010 3:30 pm

I'm glad you brought this subject up, Gary. Maybe we'll get Pierre to implement Lanczos-8 (Sinc-256).
<!-- Please stay tuned as i'll keep adding more links to external resources. //-->

User avatar
JohnFredC
XnThusiast
Posts: 2010
Joined: Wed Mar 17, 2004 8:33 pm
Location: Sarasota Florida

Re: resizing algorithms

Post by JohnFredC » Sun Aug 29, 2010 3:47 pm

2 XnTriq

Thank you once again for being our link-meister. Man, there is some good stuff in that post!

:D
John

maphew
Posts: 1
Joined: Tue Apr 28, 2015 6:50 pm

Re: resizing algorithms

Post by maphew » Tue Apr 28, 2015 6:54 pm

Excellent summary thread, thank you @gazzawazza. If you're still hanging around these parts: are you sharpening at the beginning or the end of the processing chain? (before or after reducing)

gazzawazza
Posts: 5
Joined: Wed Jul 08, 2009 10:26 am

Re: resizing algorithms

Post by gazzawazza » Tue Apr 28, 2015 11:06 pm

maphew wrote:Excellent summary thread, thank you @gazzawazza. If you're still hanging around these parts: are you sharpening at the beginning or the end of the processing chain? (before or after reducing)
hi Maphew

I'm kinda around, meaning I was notified someone had posted to this thread, so came to see what had been said :)

Glad you felt I have contributed - twas a long time ago!

I'm still using xnview and just rescale with lanczos. I personally sharpen at the end and am very careful with it, as it's something of an art ;)

I don't think it occurred to me to sharpen before rescaling - just thinking logically, since over-sharpening can leave artefacts, maybe it's better to not add 'extra' to an image, which could then be amplified with the rescaling?

My gut instinct is to sharpen on the end-image but I've no proof for that assertion. I guess I am just looking to tweak the image, as lanczos can blur out a bit.

You have any suggestions or experience on this?



Regards,

Gary

User avatar
XnTriq
Moderator & Librarian
Posts: 5424
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: resizing algorithms

Post by XnTriq » Tue Apr 28, 2015 11:45 pm

XnTriq ([url=http://newsgroup.xnview.com/viewtopic.php?p=109743#p109743]bicubic resize ?[/url]) wrote:
Algorithms currently available in XnView v1.9 (Image » Resize):
  1. Nearest Neighbour
  2. Bilinear
  3. Hermite (Cubic Hermite spline?)
  4. Gaussian
  5. Bell
  6. Bspline
  7. Mitchell
  8. Lanczos (3-lobe)
  9. Hanning
foxyshadis ([url=http://newsgroup.xnview.com/viewtopic.php?t=3496]Info about Resampling algorithms[/url]) wrote: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.

[...]

Point, box, and nearest neighbor are (usually) synonyms for the same thing, [...]
Nicky Page ([url=http://nickyguides.digital-digest.com/bilinear-vs-bicubic.htm]Bicubic Resizing vs Bilinear[/url]) wrote:Everyone uses Bicubic resizing religiously when they make DivX movies or any time they resize pictures in photo editing software. I have suggested that it is best to use Bilinear to shrink images and Bicubic to enlarge them. In fact I believe it is a rule that shouldn't be broken. But then again there is mixed opinion even among experts on this matter. Digital photo experts JASC (makers of Paint Shop Pro) comment: "Use the Bilinear Resampling method for shrinking these images and Bicubic for enlarging them". Whereas the help file of Adobe Photoshop just mentions that Bicubic is more exact method for resizing. In actual fact Bicubic is more precise, but only when it comes to enlarging. When it comes to shrinking its exactness can actually produces pixelation, because to shrink an image pixels must be discarded anyway.

The following shows examples demonstrating this effect. There are reasons you may prefer Bicubic shrinking methods though. Namely, if sharpness is absolutely vital and pixelation problems are less important.

Post Reply