Imagemagick convert resize then crop

You would use the area-fill (^) geometry modifier on the -resize operation to unify the down-scale. For cropping the center, -extent with -gravity Center will work.

convert input.jpg -resize 100x100^ \
                  -gravity Center  \
                  -extent 100x100  \
        output.jpg

Update

As Mark Setchell pointed out in the comments, the mogrify utility can be leveraged to batch convert items.

mogrify -path ./path/to/write/results/ \
        -resize 100x100^ \
        -gravity Center  \
        -extent 100x100  \
        ./path/to/source/files/*

reminder Reminder: Mogrify will overwrite original file with resulting image(s), unless you set the -path parameter.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)