Waiting for feedback, and noticing that the Robidoux* schemes give results that I consider pretty good, that every method shows some moire (although someone could argue that this is because I did not pre-filter), and also that some people like the look of (EWA) Catrom (eek!), at least some of the time, I had a
Possibly very good idea
Question: What do -distort Resize Robidoux, RobidouxSharp, Mitchell and Catrom (and actually Cubic as well) have in common?
Answer: They are Keys cubic splines
http://www.imagemagick.org/Usage/resize/#mitchell used as EWA (Elliptical Weighted Averagin) filter kernels. Cubic (at the top left of the graph
http://www.imagemagick.org/Usage/img_di ... survey.gif) is Cubic B-spline smoothing, which is a pretty good approximation of a pretty strong Gaussian blur, and corresponds to alpha=0. Catmull-Rom (at the bottom) has alpha = 1/2.
In IM, the Keys alpha value is set through the C parameter of the BC-spline generator. Basically, the smaller the C value, the more blurry the result (and the least aliasy); the larger, the sharper (hello moire!).
So, a systematic procedure for downsampling the image and getting something which is just about as sharp as can be but with bearable moire could go as follows:
Start with, say, EWA Catrom (I am assuming you are an Artificial Acutance Addict; if not, start with the default EWA, namely Robidoux, which approximately corresponds to c=.3109, and which you get if you don't specify a filter when using -distort Resize; RobidouxSharp is another good choice by virtue of also carrying my name):
Code: Select all
magick INPUT.IMG -colorspace RGB -filter Catrom -distort Resize WIDTHxHEIGHT -colorspace sRGB OUTPUT.IMG
If you are happy with what you see, pat yourself on the back and return to channel surfing.
Otherwise, search for a better alpha = c value. If you want to be systematic about it, you could use the classic Bisection Method
http://en.wikipedia.org/wiki/Bisection_method for finding the c value for which moire+halo = blur (first thing, you must rewrite the equation as moire+halo-blur=0, or blur-(moire+halo)=0 to turn the moire+halo=blur equation into a root finding problem), as follows (you could also just try values, lowering c when there is too much moire, and raising it when you want more sharpness):
Cubic B-Spline, which is just about as blurry as tolerable, is c=0. Catrom, which is just about as halo-y as tolerable, is c=1/2.
Let's try the average, namely 1/4:
Code: Select all
magick INPUT.IMG -colorspace RGB -filter Cubic -define filter:c=.25 -distort Resize WIDTHxHEIGHT -colorspace sRGB OUTPUT.IMG
If there is still too much moire, take the average of 0 and .25:
Code: Select all
magick INPUT.IMG -colorspace RGB -filter Cubic -define filter:c=.125 -distort Resize WIDTHxHEIGHT -colorspace sRGB OUTPUT.IMG
If moire is minimal, and you want to push the sharpness back up, take the average of .25 and .5:
Code: Select all
magick INPUT.IMG -colorspace RGB -filter Cubic -define filter:c=.375 -distort Resize WIDTHxHEIGHT -colorspace sRGB OUTPUT.IMG
Repeat until you're happy or the commercial break is over (this is not an exclusive "or").