I have a directory full of images that I would like to resize to around 60% of their original size.
How would I go about doing this? Can be in either Python or Perl
Can it be in shell?
mkdir resized
for a in *.jpg; do convert "$a" -resize 60% resized/"$a"; done
If you have > 1 core, you can do it like this:
find . -maxdepth 1 -type f -name '*.jpg' -print0 | xargs -0 -P3 -I XXX convert XXX -resize 60% resized/XXX
-P3 means that you want to resize up to 3 images at the same time (parallelization).
If you don't need to keep originals you can use mogrify, but I prefer to use convert, and then rm ...; mv ... - just to be on safe side if resizing would (for whatever reason) fail.