Posted By

Dorgendubal on 03/04/09


resize image Bash convert

Versions (?)

Who likes this?

3 people have marked this snippet as a favorite


Resize all images in directory

 / Published in: Bash

  • Resized images are generated into TARGET_DIR.
  • Change the resolution (800x800 in my example) and quality (80) as you want.
  • The command keeps the image's proportion. 1600x1200 will be converted into 800x600, 1200x1600 into 600x800.

Notice: the command does also resize images in sub-directories but put them in the same target directory (overwrites any existing file).

  1. find SOURCE_DIR -print -name "*.jpg" -execdir convert -resize 800x800 -quality 80 '{}' 'TARGET_DIR/{}' \;
  2. find Pictures/ -print -name "*.jpg" -execdir convert -resize 800x800 -quality 80 '{}' '/tmp/test/{}' \;

Report this snippet  

You need to login to post a comment.