My ImageMagick resize settings
A long time ago I was handling a lot of images, and I wanted to properly resize them, and I found out about ImageMagick which is a very powerful tool for all kinds of image manipulation.
I noticed there was the tool called convert which allows you to do many kinds of transformations, resizing included.
NOTE: In Version 7 the convert command is deprecated and you should use magick directly, this post will continue to say convert but will use the proper commands
I delved into the documentation of convert, and looked at all options, trying to see what was relevant for me (being a beginner for image processing).
Here is what I always add to it:
General options
-monitor
I want to see it working, and this shows the progress of what it's doing
-virtual-pixel dither
Beyond the limits of the image, there is a void, and it's up to you to decide what is there for the purposes of trying to interpolate neighbouring pixels.
I prefer to have a dithering pattern based on the image itself.
-interpolate catrom
In order to get the intermediate color between two (or four) pixels, you need some formula to get it, by default it's bilinear/triangle, but I like using a more difficult one, the Catmull-Rom Spline
-quality 100
This makes sure the quality is not lost by re-encoding, and any changes are by the resizing.
-colorspace Oklab and -colorspace sRGB
In order to more appropiately merge colors together, it's prefered to use another color space, and my pick is for Oklab, since it better represents how the human eye sees colour, and as such any math makes it look better. Afterwards we have to turn it back to sRGB since that's what computers use.
Resizing
There are many ways to resize images, and so here I list a few, which are the ones I use the most
-scale
This is a mixture of 'Box' and 'Triangle', which acts like Box for integers and Triangle for fractions. This is much faster than doing either separately.
-magnify
This is mostly for pixel art, and by default uses scale2x for making it more round but not blurry.
-resize
This allows for many filters to be used, which...
Filter
Filter is a bit more complicated, as it can change a lot for different ones, here are the ones I like
-filter Gaussian -define filter:blur=0.75
This is known as “Gaussian Interpolator” and is a sharper Gaussian filter, which is nice for downsampling.
-filter Lanczos
Lanczos is a Windowed Sinc filter, that uses the Sinc function as the window itself.
It's recommended for Real Photographs.
-filter Mitchell
The Mitchell-Netravali Filter was made after a survey agreed that using a cubic spline with certain values looked good to some experts.
When in doubt, you can use this.
-filter Robidoux -distort Resize
Distort? Yes, instead of using Orthogonal (up, down, left, right) we have Circles!
Nicolas Robidoux noticed Cubic filters looked good in Cylindrical distortions, and created his own filter which is fast and good.
Can be used instead of Mitchell-Netravali if you feeling fancy.