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
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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.