Composit 3 images using a single RGB mask
Re: Composit 3 images using a single RGB mask
Can mogrify extract the size of the first image as well? I've been using it in other cases too btw
Re: Composit 3 images using a single RGB mask
Nevermind, I found another solution
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Composit 3 images using a single RGB mask
It would be nice if you provide your solution to help others.blurymind wrote:Nevermind, I found another solution
Re: Composit 3 images using a single RGB mask
My solution was to first get the image size by using
convert image -format "%w x %h" info:
Then resizing with mogrify. I however couldnt get it to do it in a single command
I am new to nesting commands in imagemagick - thus why i needed help for the channel mask syntax
convert image -format "%w x %h" info:
Then resizing with mogrify. I however couldnt get it to do it in a single command
I am new to nesting commands in imagemagick - thus why i needed help for the channel mask syntax
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Composit 3 images using a single RGB mask
In unix, you can do it in two lines for IM 7
I do not know the syntax for Windows to save into a variable and reuse the variable.
Code: Select all
size=$(magick image1 -format "%wx%h" info:)
magick mogrify -resize "$size" .....
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Composit 3 images using a single RGB mask
ImageMagick has no feature for nesting commands. Bash does, and bash can be used on Windows.blurymind wrote:I am new to nesting commands in imagemagick ...
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Composit 3 images using a single RGB mask
In Unix, you can nest commands. For example, these should work
IM6:
IM7:
IM6:
Code: Select all
mogrify -resize $(convert image1 -format "%wx%h" info:) *.png
IM7:
Code: Select all
magick mogrify -resize $(magick image1 -format "%wx%h" info:) *.png
Re: Composit 3 images using a single RGB mask
Its neat that imagemagick 7 has that command - it would be even better if it can also name the end files properly
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Composit 3 images using a single RGB mask
What command are you referring? Name them in what way?blurymind wrote:Its neat that imagemagick 7 has that command - it would be even better if it can also name the end files properly
If using mogrify, they should get the same name as the input file (and write over the input with the newone) or you can use -path to write them to an existing other (empty) directory.
Re: Composit 3 images using a single RGB mask
This commandfmw42 wrote:You have to be using IM 7 and then there is a different syntax that needs to be used.
In IM 7, you can do
You cannot do this in IM 6.Code: Select all
magick image1 -set option:mysize "%wx%h" image2 image3 ... imageN -resize "%[mysize]" result.png
You still have not provided your IM version!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Composit 3 images using a single RGB mask
magick or convert can only write one output name, but it can be modified. For example, I believe, you could write to x-inputname.png. But the basename "x" must be there or some other placeholder for the output name. See -set filename: at http://www.imagemagick.org/Usage/basics/#set. Unfortunately, you cannot leave some basename off.
That is why mogrify exists, to process one output for each input. Magick and convert typically only process one or more input images and generate one output image name. The nested magick inside magick mogrify does this all in one command.
That is why mogrify exists, to process one output for each input. Magick and convert typically only process one or more input images and generate one output image name. The nested magick inside magick mogrify does this all in one command.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Composit 3 images using a single RGB mask
Turns out the IM 7 is more flexible than I thought in terms of writing one output for each input and making the filenames the same, though a common suffix needs to be used for the output.
So you can do this:
or this:
So you can do this:
Code: Select all
magick rose.png -set option:mysize "%wx%h" logo.png netscape.png -set filename:f "%[t]" -resize "%[mysize]" "%[filename:f].png"
Code: Select all
magick *.png \( +clone -set option:mysize "%wx%h" +delete \) -set filename:f "%[t]" -resize "%[mysize]" "%[filename:f].png"
Re: Composit 3 images using a single RGB mask
hi, thank you for sharing these. Glad to see IM getting better at this type of thing!!