cd pathto/folder1 mogrify -path pathto/folder2 -format jpg -resize 400x800 -gravity center -background white -extent 400x800 *.jpg
this will take only jpgs from folder1, resize them so the larger dimension is 800 keeping the aspect ratio on the smaller dimension, then pad with white so that the smaller dimension gets filled with white out to 400 pixels. You an also force an exact fit to 400x800 using the ! but that will change the aspect ratio and distort your pictures. If you do not use separate folders, the new images will be put into the old folder and you may get both the old and new images there. So I like to move the new ones to a new folder so that I do not destroy the old ones and it is easy to delete the new folder and start again if it is not the way I want. Note that both folders must exist before running mogrify see http://www.imagemagick.org/Usage/basics/#mogrify http://www.imagemagick.org/Usage/crop/#extent http://www.imagemagick.org/script/command-line-processing.php#geometry http://www.imagemagick.org/script/command-line-options.php#extent You will need to try this as I have not tested it. Mogrify is old and does not support all processing options. So I am not sure about the use of -gravity and -extent. Dear Image-Magic users! I'm new to imagemagic and this is my first magic-list message. Recently I met a task of resizing every image in a folder. There's more than 4000 images in the folder. They are of different sizes, 500x500 pixels in average. i need to re-size them all to 400x800 pixels. Using 'mogrify -resize 400x800 the_folder/*.jpg' I can only restrict the maximum size (height or weight). '-size' option, as I can see will re-size pictures and brakes proportions. So, my question is: is there an option that would re-size all pictures like '-resize' and fill blank areas with any colour (say, white) to desired dimensions? Tips and answers will be greatly appreciate! Thank in advance, -- Hiisi. Registered Linux User #487982. Be counted at: http://counter.li.org/ _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
