I am trying to automate the converting images to specified tif formats. I have it converting just fine, but am also needing to add "_GS" at the end of the file name and before the extension to each file converted. Below is what I have but have had no luck finding a solution to add "_GS" to the file name. Thanks in advance for any help.
for f in "$@"
do
echo "$f"
/usr/local/bin/mogrify -density 300 -resize 1000x1000 -type grayscale -define tiff:endian=msb -compress LZW -format tif "$f" [0]
done
Item 1: With Image Magick, to create a new file instead of overwriting an existing one, use
convert, notmogrify(magick convertwith newer versions of IM).Item 2: You can use shell parameter expansion to remove the extension, and then build the new filename from that and the new suffix:
${variable%pattern}returns the expansion ofvariablewith the shortest match ofpatternremoved from the end.