Difference between resize/distort ?

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
Nicolas P. Rougier
Posts: 5
Joined: 2012-07-05T11:19:51-07:00
Authentication code: 13

Difference between resize/distort ?

Post by Nicolas P. Rougier »

Hi all,

I've been trying to modify the "lupe" script by adding a point filter to the distort operation but it does not seem to work. More generally, these two commands differ on my machine:

convert rose: -filter point -resize 200% show:
convert rose: -filter point +distort SRT '2 0' show:

The first one is the result I want (no interpolation) while the second one does not seem to take the filter into account (resulting in an interpolated magnification). Did I miss something obvious ?


Nicolas

---

ImageMagick version: LIB_VERSION_NUMBER 6,7,7,6
os : darwin11.4.0
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Difference between resize/distort ?

Post by anthony »

-filter point in -resize means just use nearest neighbour interpolation for the color lookup. You can not select what type of lookup you want.

That is equivalent to using -sample.
See, Filter Point...
http://www.imagemagick.org/Usage/resize/#point

In -distort however it means use a single point interpolative lookup of color, which uses the -interpolate setting, defaulting to "bilinear"
See Distort, Interpolated, or Direct Color Lookup
http://www.imagemagick.org/Usage/distor ... nterpolate
And Interpolation
http://www.imagemagick.org/Usage/misc/#interpolation

If you would like to use 'point' interpolation for resizing, you can use the operator -interpolative-resize. Added sometime around IM v6.7.7-3 for easier testing of new interpolation methods and changes.

WARNING: interpolation works for enlargements, but will cause server aliasing when shrinking image by more than 50% as it is NOT an 'area weighted averaging' or 'filtered' resampling technique (both have the same meaning, just a different way of viewing the calculation of color lookup).

Actually reading the first part of the distort page, and later the Resize filters page will give you a good understanding of how all distortion/resize operators work in ANY image processing package, regardless of if orthogonal resize filtering, or elliptical area resampling (or perhaps something else in the future).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply