I was wondering if someone could help me craft a bash command to convert all .tiff on our server. I would like to convert all the .tiff to png. I would like to ignore all alpha channels UNLESS the filename contains the text "cut" (case agnostic), and if it does contain that text to save the image WITH the alpha channel intact.
As far as I am is
Code: Select all
for f in *.tif; do echo "Converting $f"; convert "$f" -alpha off "$(basename "$f" .tif).png"; done
and
Code: Select all
for f in *.tif; do echo "Converting $f"; convert "$f" "$(basename "$f" .tif).png"; done
What I am unsure on is how to regex to look for the text in the filename, and how to handle the logic of if matches run this, else run that.