Hi,
I don't know howto to made a flow to combine all sequence of 2 identical named mages into 1 image with Imagemagick :
- 2 images have a same name but have a different+ suffix to identify the background for combining images :
image01_background
image01_portrait
image02_background
image02_portrait
etc....
imagemagick command to use should be :
magick convert image01_background.jpeg image01_portrait.jpeg -gravity center -composite image01_result.jpeg
but with EnfocusSwitch I didn't know how to insert correctly variables to find for each couple of images the right image
I already use ImageMagick with single image in a Flow, with arguments like this :
"%1" -resize 1010x1020 -background white -gravity Center -extent 1010x1020 "%2"
it works perfectly.
But here, with 2 images, I didn't know how to specify the files to combine
Thanks in advance, let me know if you need further informations for understand my issue
Regards,
Christian
Flow to combine 2 images with ImageMagick
-
- Newbie
- Posts: 15
- Joined: Wed Nov 30, 2022 1:15 pm
Re: Flow to combine 2 images with ImageMagick
Hi Christian,
You basically have two options here that will affect the variables you will set and how to use them. But first, let's have a look at about how you can merge files with Magick.
Rather than listing "files", you can simply use a wildcard: [my folder path]/*
With that in mind, you can set "%1/*" as the folder path for Magick to compose all the files within that folder.
Now the output, say you want the composed file to be found on the output folder. Then you will ask for "File at path" in the output options.
And your command will use %2 as the name of the output file. If you want to use "Result in folder", then you would use %3 as the folder where you will output the composed file.
Both ways will require extra work (renaming for file at path and extraction for result in folder)
I also recommend that you use a bash/bat command to have more freedom over the syntax.
Here are some settings I could use with success:
Command:/bin/bash
Arguments (Using variables): "/path/to/bash/bat/file.sh" "%1" "%2" [Job.NameProper]
Output: File at path
For the bash file:
"/opt/homebrew/bin/magick" convert "$1/*" -gravity center -composite "$2"
if you want to use Result in Folder, then the bash would be:
"/opt/homebrew/bin/magick" convert "$1/*" -gravity center -composite "$2/$3"
of course you would need to edit Arguments as such:
Arguments (Using variables): "/path/to/bash/bat/file.sh" "%1" "%3" [Job.NameProper]
HTH
Loic
You basically have two options here that will affect the variables you will set and how to use them. But first, let's have a look at about how you can merge files with Magick.
Rather than listing "files", you can simply use a wildcard: [my folder path]/*
With that in mind, you can set "%1/*" as the folder path for Magick to compose all the files within that folder.
Now the output, say you want the composed file to be found on the output folder. Then you will ask for "File at path" in the output options.
And your command will use %2 as the name of the output file. If you want to use "Result in folder", then you would use %3 as the folder where you will output the composed file.
Both ways will require extra work (renaming for file at path and extraction for result in folder)
I also recommend that you use a bash/bat command to have more freedom over the syntax.
Here are some settings I could use with success:
Command:/bin/bash
Arguments (Using variables): "/path/to/bash/bat/file.sh" "%1" "%2" [Job.NameProper]
Output: File at path
For the bash file:
"/opt/homebrew/bin/magick" convert "$1/*" -gravity center -composite "$2"
if you want to use Result in Folder, then the bash would be:
"/opt/homebrew/bin/magick" convert "$1/*" -gravity center -composite "$2/$3"
of course you would need to edit Arguments as such:
Arguments (Using variables): "/path/to/bash/bat/file.sh" "%1" "%3" [Job.NameProper]
HTH
Loic
-
- Newbie
- Posts: 15
- Joined: Wed Nov 30, 2022 1:15 pm
Re: Flow to combine 2 images with ImageMagick
Hi Loic, thanks for your answer and your help ! I'll made my test and give you feedback !
Thanks for your tips !
Regards,
Christian
Thanks for your tips !
Regards,
Christian