The imagemagick site has a demo on this page: http://www.imagemagick.org/Usage/resize/#resize
I want to perform the action in this example:
convert logo: -resize 80x80\> \
-size 80x80 xc:blue +swap -gravity center -composite \
space_resize.jpg
But for a large number of files. I think the right tool is mogrify, but it does not know the +swap or xc:blue flags.
Advice?
I was able to accomplish the above by using the following:
mogrify -resize 300x300 *.jpg
mogrify -extent 300x300 -gravity Center -fill white *.jpg
This will make the largest dimension of the images to 300 pixels. It will then fill the canvas on the shorter dimension to 300 pixels and fill in the empty space with white.
For me your solution just clips 300x300 portion from my big image.
Next command works correctly, adding white space around image:
mogrify -extent 640x640 -gravity Center -fill white *.jpg[640x640]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With