I'm trying to write automation service that gets all images exclude .jpg from the current directory (or selected files), convert them to .jpg by imagemagick mogrify and delete old images.
script: mogrify -format jpg *.* && find . -type f ! -name "*.jpg" -delete
I've tried my script in the terminal and it works fine.
Then, I've created automator service for doing the same thing from context menu and I'm stacked.
It make error
The action “Run Shell Script” encountered an error: “zsh:1: command not found: mogrify”
UPD.
Thanks to Mark Setchell, /opt/homebrew/bin/magick
works fine, but i'm still having errors that you can see below. Looks like the script executing in the incorrect folder.
UPD2.
I fixed it by passing input as argument and using this argument (folder) for changing directory before script
As you are on a Mac, you probably installed via homebrew, so ImageMagick binaries are likely in /usr/local/bin
or /opt/somewhere
.
You can use this command in Terminal to find it:
find /opt /usr -name magick
So if you find /opt/somewhere/bin/magick
, use:
/opt/somewhere/bin/magick mogrify ...
in your script.
Prior to v7, ImageMagick had lots of commands in its suite - convert
, mogrify
, compare
, compose
, animate
, conjure
, display
and so on. In v7, all commands were prefixed with magick
so there is just one command and "the namespace is less polluted" as some folks call it. The convert
command also used to clash with some Microsoft CONVERT.EXE
thing on Windows that converts filesystems from one format to another.