How to add an ImageMagick command to a script?


I have successfully added an ImageMagick command in a script by specifying the convertpath:

set convertPath to "Macintosh HD:opt:local:bin:convert"

and then including the command:

-- setup the image magick command
set convertCommand to quoted form of POSIX path of convertPath & " -define jpeg:size=840x500 -thumbnail '420x250>' -background '#24221F' -gravity center -extent 420x250 -quality 95 "

but, now I have another command, which works from terminal, but which is in a different format:

convert thumbnail.gif
( +clone -alpha extract
-draw ‘fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0’
( +clone -flip ) -compose Multiply -composite
( +clone -flop ) -compose Multiply -composite
) -alpha off -compose CopyOpacity -composite -compose over -background red -flatten thumbnail_red_corners.gif

when I try to enter this command in my script in place of the command that works I get a syntax error:

Expected “”" but found unknown token.

So, I am wondering how I can incorporate the ImageMagick command in my script and would be grateful for any help,



have you tried using do shell script?

do shell script "say \"cheese\""

So long as you escape all double quotes, it should work, and you can get the result by assigning it to a variable.