Skip to content
Advertisement

ImageMagick using convert and rename output

I a directory I have several files name like 13992.jpg 13993.jpg 13994.jpg 13995.jpg …

How do I rename these files using convert? I have tried

 convert -thumbnail 62 %d.jpg[11000-19000] $d_thumb.jpg

but it is not working… Any suggestions?

Advertisement

Answer

you probably want to run convert in a loop, like

for pic in *.jpg; do
    echo convert "$options" "$pic" "${pic%.*}.thumb.jpg"
done

consider also this little “trick” for renaming:

pic=foo123     # file name stripped of extension
echo "convert options..." $pic{,.thumb}.jpg
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement