On Tue, 17 Feb 2009 12:02:03 -0800 Qiong Liu <[email protected]> wrote: | According to the manual, the "-filter" parameter only works for | "-resize". When we perform affine transformation or other image | transformations that cannot make a transformed pixel on the final | image pixel grid, what kind of interpolation method does ImageMagick | use? Nearest Neighbor? May I set that filter?
Well seeing as I re-designed the filter system I can answer this rather verbosely! It use to be only resize! Not any more. Also there are TWO filter systems. True Scaled Filters (resize) and Unscale Interpolated Filters (direct pixel lookup) Resize Usage... Filter is used for resizing images, whcih includes -resize -resample and -geometry (not recomended). Other resize operators use a fixed filter for specific requirements. Resize filtering is internally a 2 pass orthogonal 1-dimentional filtered resampling, which means the filter is used to first compress the image in one direction, then the other. I forget which order it is, but it does not really matter. See IM Examples, Resize, for ALL the filter details!!!! http://www.imagemagick.org/Usage/resize/ Distort Usage... The filter setting is also used by -distort (and thus -affine) but using a 1-pass 2-dimensional cylindrical form of image filtering as the image can be rotated as well as re-sized part of the distortion. Also each pixel may resize (or scale) differently accross the image. Currently -distort default to a gaussian filter (if not set) whcih is a little blurry. This was the default for EWA area re-sampling. For details see the top section of IM Examples, Distort http://www.imagemagick.org/Usage/distorts/ You can use other filters for distort too, but the code is currently limited to a fixed support radius '2' units, which works well for gaussian and cubic filters like 'Michell', but fails for 'Bessel/Sinc' windowed filters. This limitation is not simple to fix, and will require very careful re-coding of the generate filter cache in distort. Using Windowed Bessel filters with its large support would also slow distorts enormously! In otherwords it is complex to fix with little reward for the effort. Distort Filter Cavat.... As mentioned distort has variable scaling for each pixel. That is the area being re-sampled is different for each pixel. The filter and EWA resampling is good for Compression types of distorts, But enlargements it breaks down, so it switched to a interpolation method. As such for distort cylindrical filters are used for areas of image compression, but interpolated filter methods are used for enlargements. Controling filter use in Distort.... Distort filters can be turned off (forcing the use of interpolation) by setting -filter point OR interpolation can be turned off by using -interpolate filter I am not actually certain what will happen if you use BOTH, probably a 'nearest-neighbour' interpolation or 'box' filter (both mean the same thing). NOTE that last is true for any interpolated function. You can specify the use of a unscaled filter for pixel lookup interpolation by setting -interpolate filter -filter (whatever) Anthony Thyssen ( System Programmer ) <[email protected]> ----------------------------------------------------------------------------- "Where's the kaboom? There was supposed to be an EARTH-shattering kaboom!" -- Marvin Martin ----------------------------------------------------------------------------- Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/ _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
