Page 1 of 1

Using Filters for resizing

Posted: 2016-07-20T10:05:31-07:00
by vmpre
Hey everyone

Newb here.

Been experimenting with IM for some image resizing that I need to do.

My input image is 4096x4096 that I am resizing to 1024x1024 and I would like to experiment with different filters to see what results I get.

I am doing two conversions to do a comparison of the results

Control Test:

Code: Select all

convert.exe input.psd[0] -colorspace LAB -resize 1024x1024 -colorspace sRGB output.tif
Filter Test:

Code: Select all

convert.exe input.psd[0] -colorspace LAB -filter Lanczos -resize 1024x1024 -colorspace sRGB output_lanczos.tif
The thing is...I dont notice a difference between the two results. They are completely identical.

For that matter most of the Windowed filters seem to have no effect at all.The other filters like point and gaussian do yield different results.

Using ImageMagick-7.0.2-Q16-HDRI

Unfortunately I am unable to post my source image as it is a protected image. Sorry! :(

Am I missing something?

Thanks for any guidance!

Cheers!

Re: Using Filters for resizing

Posted: 2016-07-20T10:12:12-07:00
by snibgo
vmpre wrote:Am I missing something?
Yes. See http://www.imagemagick.org/script/comma ... php#filter :
If you do not select a filter with this option, the filter defaults to Mitchell for a colormapped image, an image with a matte channel, or if the image is enlarged. Otherwise the filter default to Lanczos.

Re: Using Filters for resizing

Posted: 2016-07-20T13:09:09-07:00
by Bonzo
The filters can have more effect on some images than others; depending on the subject.

This is some php code I wrote a while ago that used to resize an image with all the available filters. With IM version 7 you may need to change convert to magick.

Code: Select all

<?php 
// Build the array of filters to be used  
exec("convert -list filter", $IMarray, $code);  
// Start the loop to resize with the different filters  
foreach ($IMarray as $value) {  
$new_name = $value."_resize.png";  
exec ("convert input.png -filter $value -resize 300x300 -bordercolor black -border 1x1 $new_name");  
echo "<tr><td><img src=\"".$new_name."\"></td>";  
echo "<td>$value</td></tr>";  
}  
?>

Re: Using Filters for resizing

Posted: 2016-07-20T13:18:48-07:00
by fmw42

Re: Using Filters for resizing

Posted: 2016-07-20T14:50:41-07:00
by vmpre
Thanks everyone!

That helped a lot. I think I have it now.

Set up a little bat file that spit out images with all the different filters. Some of them (at least on the image I was testing) had almost imperceptible differences in them. Had to zoom in about 1200% in some cases to even see anything.

Cheers that helped!