Why are IM and GIMP different on downscaling (same filter)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
waveletboy

Why are IM and GIMP different on downscaling (same filter)

Post by waveletboy »

Both of IM and GIMP use Sinc filter.

Because the original is 3072x2304, and I want to resize it to 800x600, I downscale it two times.
For IM,
convert input.jpg -filter Sinc -resize 1600x1200 -filter Sinc -resize 800x600 -quality 100 output.jpg

For GIMP, I use "Scale Image" menu and select Sinc(Lanczos 3) Interpoation. Also scale two times as 1600x1200 and 800x600.

Also I tried Lanczos on IM, I can't tell the difference between Sinc and Lanczos.

It looks GIMP has more sharpen effect than IM. Could anyone tell me why? Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Why are IM and GIMP different on downscaling (same filter)

Post by fmw42 »

There are a lot of factors that make a filter implementation on one system different from another system. Some of these factors are how many filter taps or support (how many samples are used in width and height), lobes and windowing.

For IM this is all detailed on the following page. Thanks to Anthony for all his hard work in improving IM's filter capabilities and his detailed explanations and examples.

http://www.imagemagick.org/Usage/resize/

There are now expert settings that will let you control these factors as well as special support for more blurring or sharpening.

GIMP is an unknown in terms of what they created in terms of all these parameters. You would have to download the source code for both and compare.
waveletboy

Re: Why are IM and GIMP different on downscaling (same filter)

Post by waveletboy »

Thanks a lot. I have read Anthony's work before I raise the question. For a rookie like me, I cannot totally understand it. :?
Although GIMP has more sharpen looking on Sinc(Lanczos3) may be good for first looking, but it has too many spurious edges. I will still use IM because I don't know how to adjust the filters. :lol:
fmw42 wrote:There are a lot of factors that make a filter implementation on one system different from another system. Some of these factors are how many filter taps or support (how many samples are used in width and height), lobes and windowing.

For IM this is all detailed on the following page. Thanks to Anthony for all his hard work in improving IM's filter capabilities and his detailed explanations and examples.

http://www.imagemagick.org/Usage/resize/

There are now expert settings that will let you control these factors as well as special support for more blurring or sharpening.

GIMP is an unknown in terms of what they created in terms of all these parameters. You would have to download the source code for both and compare.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Why are IM and GIMP different on downscaling (same filter)

Post by anthony »

the 'Sinc' filter in IM is present as a raw function for use in expert selections of the filter and windowing function. It really shouldn't be selected directly as an actual filter function.

By default selecting -filter Sinc, will result in a Blackman windowed Sinc filter (equivelent to -filter Blackman), and is done that way purely for historical reasons. (Previous versions of IM did this).

The Lanczos filter will result in a 3 Lobed Sinc windowed Sinc filter, which is equivalent to the one in Gimp and often thought of as the best compromise of all the Sinc family of windowed filters.

The default filters in IM is 'Lanczos' for shrinking images without any transparency, and the 'Mitchell' cubic filter for all other cases (as it has a reduced ringing artifact, and is faster due to a smaller 'support' window, while still being a very good filter).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply