just some notes

Imagemagick, mass resize photos

I use Imagemagick when I have a lot of pictures that need to be resized for being used on a website. From a shell, the command for resize a picture is:

$ mogrify -resize <width_pixel>x<height_pixel> file.jpg

For resize all pictures inside a folder, via shell move to the folder and give:

$ mogrify -resize <width_pixel>x<height_pixel> *

Some time pictures are in more sub-folder, and is not very comfortable move to each folder for launch the resize command.
You can use a simple “batch script”, move to the folder via shell and give:

$ find . -type f | xargs mogrify -resize <width_pixel>x<height_pixel> {}

For resize only .jpg files:

$ find . -type f -name "*.jpg" | xargs mogrify -resize <width_pixel>x<height_pixel> {}

N.b. name is case sensitive

Resize if bigger or smaller than

If you want to resize the file only if bigger or smaller than the values used for resize use (bigger than) > or (smaller than) < :

$ mogrify -resize '1000x1000>' *

Leave a Reply

Powered by WordPress | Designed by Elegant Themes