Page 1 of 1

ImageMagick and Run Command issue with JPEG

Posted: Thu Jan 30, 2025 10:48 am
by valaxedo
Hello members!
I'm quite a newbie in these fields, and I'm looking for an explanation about an issue.
My goal is to append two jpeg images into one.

To do so, I installed the Run Command from AppStore using Zsh with the following command:

/opt/homebrew/Cellar/imagemagick/7.1.1-43/bin/magick %%[Job.Path]%/[Job.NestedName:Index="2",Space="trim"] %%/[Job.Path]%%/[Job.NestedName:Index="3",Space="trim"] -append result.jpg

Each time, I receive this error:
Command failed with exit code: "1", Error output: "magick: no decode delegate for this image format `' @ error/constitute.c/ReadImage/746. "

I tested the same function in the Terminal and it worked fine:
svc_masterbrowser@FLO-MAC-107036 ~ % magick /Users/svc_masterbrowser/Desktop/JUSTDANCE_Inlay_SWITCH_1.jpg /Users/svc_masterbrowser/Desktop/JUSTDANCE_Inlay_SWITCH_2.jpg -append TestAppend.jpg

I'm, then, pretty sure that my syntax is not good in Switch.
Would you be able to explain what?

Many thanks
Regards.
Axel

Re: ImageMagick and Run Command issue with JPEG

Posted: Thu Jan 30, 2025 5:35 pm
by freddyp
The paths of the input file and output file that you tested in Terminal did not contain spaces. The paths to the backing folders in Switch will, and I think that is your problem. Place quotes around the paths (because there are already double quotes, I would first try with single quotes):
'%%[Job...."trim"]'

Re: ImageMagick and Run Command issue with JPEG

Posted: Mon Feb 03, 2025 3:49 pm
by valaxedo
Hello Freddy!
Thank you for your answer.

I amended it but the result, still an error, is quite different now:
"Command failed with exit code: "1", error ouput: "magick: unable t oopen image. No such file or directory @ error/blob.c/OpenBlob/3596."

It's the same with a double quote. :-(

Best.

Re: ImageMagick and Run Command issue with JPEG

Posted: Mon Feb 03, 2025 3:57 pm
by loicaigon
Hi

Have you looked at the log messages what is the command Switch exactly tries to execute?

Image

It's typically a good way to see if your command is well constructed and you can even copy/paste in a terminal to double test local vs Switch.

Re: ImageMagick and Run Command issue with JPEG

Posted: Mon Feb 03, 2025 4:38 pm
by valaxedo
Hello Loïc!
How are you?

Thank you for your input.
I already tested the cli magick cmd and it works fine.

But in Switch: Command failed with exit code: "1", Error output: "magick: unable to open image '%%/Users/svc_masterbrowser/Documents/Switch Email Template v2/IN_Magick/_000BG_000BG044%/JUSTDANCE_Inlay_SWITCH_1.jpg': No such file or directory @ error/blob.c/OpenBlob/3596. "

svc_masterbrowser@FLO-MAC-107036 ~ % magick /Users/svc_masterbrowser/Desktop/JUSTDANCE_Inlay_SWITCH_1.jpg /Users/svc_masterbrowser/Desktop/JUSTDANCE_Inlay_SWITCH_2.jpg -append TestAppend.jpg

Weird, no? What did I miss, so far?
Thanks!

Re: ImageMagick and Run Command issue with JPEG

Posted: Sat Feb 08, 2025 10:49 pm
by loicaigon
Ok,

I could get it working somehow:

"/opt/homebrew/bin/magick" "[Job.Path]/[Job.NestedName:Index="2",Space="trim"]" "[Job.Path]/[Job.NestedName:Index="3",Space="trim"]" -append "%%OutputPath%%/appended.jpg"

When i say somehow, I mean I get the appended.jpg in th output folder. If you need more or different, you will have to dig it further.

Loic

Re: ImageMagick and Run Command issue with JPEG

Posted: Mon Feb 10, 2025 12:26 pm
by valaxedo
Hello Loïc.
Thank you for the suggestion!

But I'm still have an error in the Run Command:
"Command failed wtih exit code: "1", error output: "zsh"1: unmatched " "

Best.

Re: ImageMagick and Run Command issue with JPEG

Posted: Mon Feb 10, 2025 12:28 pm
by loicaigon
On a Windows? Because sometimes you need to escape the quotes \"

Did you try using single quotes? Or you may need to contact the author of the script to get some insights?

Re: ImageMagick and Run Command issue with JPEG

Posted: Mon Feb 10, 2025 2:02 pm
by valaxedo
It's on Mac OS.
And I'm the script's owner, so far.
Even if I'm a newbie, for sure!
Anyhow, same result with just one quote.
But I found the issue.
I've missed two double quote in front and the end of the whole variable:
"/opt/homebrew/Cellar/imagemagick/7.1.1-43/bin/magick" "[Job.Path]/[Job.NestedName:Index="2",Space="trim"]" "[Job.Path]/[Job.NestedName:Index="3",Space="trim"]" -append "%%OutputPath%%/appended.jpg"

This one works perfectly.
Best.

Re: ImageMagick and Run Command issue with JPEG

Posted: Mon Feb 10, 2025 2:42 pm
by loicaigon
Did you update the bin location?

meaning
"/opt/homebrew/bin/magick"
to
"/opt/homebrew/Cellar/imagemagick/7.1.1-43/bin/magick"

I am running out of ideas :)