I'm making an Automator workflow that uses the shell script action to process a selection of images with the imagemagick composite command. Only I'm having issues getting it going. According to the results I get when I run the workflow, everything is working however, I know it's not due to the fact that the changes I'd expect to see in the folder of images are not present. I know that the imagemagick command I'm using is correct as it works correctly from the console. (I echoed the composite command to the output & copied it into a Terminal session. Ran like a charm). BTW: The workflow's for processing a fade in on a stop motion movie I made. Yes I know I could use video tools to achieve the same thing, but the ones I have access to screw up the image quality on output.
Here's the script
imagesCount=$#
rate=$(echo "scale=2; 100/$imagesCount"|bc)
percentage=$rate
for f in "$@"; do
fileName=${f%.*}
composite -blend "$percentage" -size 1280x720 "$f" xc:black -alpha Set "$fileName-1.jpg"
percentage=$(echo "scale=2; $percentage+$rate"|bc)
done
At first I thought at the cause of the problem might be spaces in the paths, but I removed this possibility by shifting the files to a path without spaces, but that had no effect.
I'm almost certain the issue is related to something in the bash command but I don't know bash at all, this is my first time writing any bash command scripts, but I am very knowledgeable in Windows console scripting and would have no trouble getting this to work there.
If the error in the script isn't obvious enough to catch, would someone propose a method to debug this so I can figure out why the images are not getting processed even though the script runs without error?
composite
with its absolute path (can be determined by executingwhich composite
on the Terminal)?$f
tof
or was that just a transcription error? Also your capitalization onfileName
is inconsistent.