Friday, 29 January 2016 00:00

Resizing Images

As a web designer I often have to resize a large number of images. Here are a couple of the commands I use. These use the ImageMagick application.

To recursivly resize images over 2000px width while preserving teh images aspect ratio and  ignoring smaller images

find . -iname "*.jpg" -exec convert "{}" -resize '2000>' "{}" \;

you can add -quality 90 to further reduce the size

To recursivly crop an image

for file in ./*.jpg; do convert "$file" -gravity Center -shave 20x20 "./out/${file%.JPG}"; done;

Read 1120 times Last modified on Friday, 29 January 2016 10:25