I am trying to create a workflow in automator to change DPI from 72 to 300, so that I can use it on any image in Finder (when i right click on the image, then I can run the action).
When I run the command in terminal, it works fine:
mogrify -units PixelsPerInch *.jpg -density 300 *.jpg
However, when I use it in shell script, it does not work, and I can't figure out why. This is what I have so far:
for f in "$@"
do
/opt/ImageMagick/bin/mogrify mogrify -units PixelsPerInch *.jpg -density 300 *.jpg
done
Any help will be highly appreciated.
mogrify
is for batch conversion (thus your *.jpg
in the working version) but in your example, you have created a loop to step through files. You don't seem to be using your f
variable at all.
You should get the command to work on individual files using the convert
command instead of mogrify
and then plug in$f
wherever the filename would occur.