Hi
I have a question about Imagemagick in Switch. I have a 2 file (tiff). I need to make the one file from two file by imagemagick like:
1.tiff 2.tiff -channel-fx "| gray=>alpha" -define tiff:alpha=unspecified "%1" "%2"
But how I can use the Switch flow to send 2 file to Imagemagic??
Imagemagick
Re: Imagemagick
You can try to send them to one folder each on disk and then you add the full path to each file.
With the app "Execute command friend" you can construct a .bat or .sh file that you send to Execute command. This file would have the complete execution command in it but it will also allow you to use variables from Switch for the file names of each TIFF-file.
https://www.enfocus.com/en/appstore/pro ... and-friend
With the app "Execute command friend" you can construct a .bat or .sh file that you send to Execute command. This file would have the complete execution command in it but it will also allow you to use variables from Switch for the file names of each TIFF-file.
https://www.enfocus.com/en/appstore/pro ... and-friend
Re: Imagemagick
You obviously have to replace 1.tiff and 2.tiff by variables. As the two files have to hit ImageMagick at the same time, you first have to assemble the two files into a job folder using "Assemble job". You can then access the first file with the variable [Job.NestedName:Index="2",Space="trim"] and the second one with index 3. Index 1 is for the name of the job folder which in this case is not important.
You also have to concatenate the path to the job folder with the variables mentioned above using a slash. In "Execute Command Friend" you will have to use [Job.Path] for that, in "Execute command" it is the variable %1 that points to the job path. So you will use [Job.Path]/[Job.NestedName:Index="2",Space="trim"] or %1/[Job.NestedName:Index="2",Space="trim"].
Caution: enclose the concatenated paths in double quotes to avoid problems with spaces in the complete path.
You also have to concatenate the path to the job folder with the variables mentioned above using a slash. In "Execute Command Friend" you will have to use [Job.Path] for that, in "Execute command" it is the variable %1 that points to the job path. So you will use [Job.Path]/[Job.NestedName:Index="2",Space="trim"] or %1/[Job.NestedName:Index="2",Space="trim"].
Caution: enclose the concatenated paths in double quotes to avoid problems with spaces in the complete path.
-
- Member
- Posts: 30
- Joined: Tue Mar 03, 2020 11:28 am
Re: Imagemagick
Thank You. I will try it.
-
- Member
- Posts: 30
- Joined: Tue Mar 03, 2020 11:28 am
Re: Imagemagick
hm ... the path is correct but always
Job failed because outcode is nonzero, outcode = [1]
My command is:
%1 /[Job.NestedName:Index="2",Space="trim"] [Job.NestedName:Index="3",Space="trim"]" -channel-fx "| gray=>alpha" -define tiff:alpha=unspecified "%2"
result: %1 /1.tiff 2.tiff" -channel-fx "| gray=>alpha" -define tiff:alpha=unspecified "%2"
Both file are in the folder called "a"
I hate those magical spells to imagemagic ....
Job failed because outcode is nonzero, outcode = [1]
My command is:
%1 /[Job.NestedName:Index="2",Space="trim"] [Job.NestedName:Index="3",Space="trim"]" -channel-fx "| gray=>alpha" -define tiff:alpha=unspecified "%2"
result: %1 /1.tiff 2.tiff" -channel-fx "| gray=>alpha" -define tiff:alpha=unspecified "%2"
Both file are in the folder called "a"
I hate those magical spells to imagemagic ....
Re: Imagemagick
The references to the input files are definitely not correct. There is a space after %1, the path should be enclosed in double quotes and the %1 is missing for the path to the second file. It should be:
"%1/[Job.NestedName:Index="2",Space="trim"]" "%1/[Job.NestedName:Index="3",Space="trim"]" -channel-fx etc.
I did not test this! You may have to be play with the double quotes because as it is here there are double quotes inside double quotes and that does not always go well.
You write "My command is:". Just to make sure: the "Command" is the path to ImageMagick, the rest goes in "Arguments".
"%1/[Job.NestedName:Index="2",Space="trim"]" "%1/[Job.NestedName:Index="3",Space="trim"]" -channel-fx etc.
I did not test this! You may have to be play with the double quotes because as it is here there are double quotes inside double quotes and that does not always go well.
You write "My command is:". Just to make sure: the "Command" is the path to ImageMagick, the rest goes in "Arguments".
-
- Member
- Posts: 30
- Joined: Tue Mar 03, 2020 11:28 am
Re: Imagemagick
Of course!. Thank You Freddy for You help. That is like always very useful.
-
- Member
- Posts: 30
- Joined: Tue Mar 03, 2020 11:28 am
Re: Imagemagick
and that is correct with Run Command connector:
/opt/homebrew/Cellar/imagemagick/7.1.0-62/bin/magick %%InputFilePath%%/[Job.NestedName:Index="2",Space="trim"] %%InputFilePath%%/[Job.NestedName:Index="3",Space="trim"] -channel-fx "| gray=>alpha" -define tiff:alpha=unspecified rezultat.tiff
https://www.enfocus.com/en/appstore/product/run-command
/opt/homebrew/Cellar/imagemagick/7.1.0-62/bin/magick %%InputFilePath%%/[Job.NestedName:Index="2",Space="trim"] %%InputFilePath%%/[Job.NestedName:Index="3",Space="trim"] -channel-fx "| gray=>alpha" -define tiff:alpha=unspecified rezultat.tiff
https://www.enfocus.com/en/appstore/product/run-command