2

I need to convert a very large number of images that are called 1a.jpg, 2a.jpg, 3a.jpg using Imagemagick to be processed and renamed 1.jpg, 2.jpg, 3.jpg (in the same directory).

The Imagemagick command is this, where n is the 1, 2, 3... etc.

convert -shave 200x200 -resize 30% na.jpg n.jpg

2 Answers 2

4

you could try something like this (ksh/bash/zsh syntax):

for f in [0-9]*a.jpg ; do 
    convert -shave 200x200 -resize 30% "$f" "${f/a/}"
done
2

With zsh:

autoload zmv # best in ~/.zshrc
shave() convert -shave 200x200 -resize 30% "$@"
zmv -n -p shave '(<->)a.jpg' '$1.jpg'

(remove the -n (dry-run), or replace with -v when happy).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .