Page 3 of 3
Re: Composit 3 images using a single RGB mask
Posted: 2016-07-24T03:24:35-07:00
by blurymind
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
Posted: 2016-07-24T07:50:33-07:00
by blurymind
Nevermind, I found another solution
Re: Composit 3 images using a single RGB mask
Posted: 2016-07-24T10:26:38-07:00
by fmw42
blurymind wrote:Nevermind, I found another solution
It would be nice if you provide your solution to help others.
Re: Composit 3 images using a single RGB mask
Posted: 2016-07-24T11:53:09-07:00
by blurymind
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
Re: Composit 3 images using a single RGB mask
Posted: 2016-07-24T11:57:14-07:00
by fmw42
In unix, you can do it in two lines for IM 7
Code: Select all
size=$(magick image1 -format "%wx%h" info:)
magick mogrify -resize "$size" .....
I do not know the syntax for Windows to save into a variable and reuse the variable.
Re: Composit 3 images using a single RGB mask
Posted: 2016-07-24T12:24:08-07:00
by snibgo
blurymind wrote:I am new to nesting commands in imagemagick ...
ImageMagick has no feature for nesting commands. Bash does, and bash can be used on Windows.
Re: Composit 3 images using a single RGB mask
Posted: 2016-07-24T12:50:56-07:00
by fmw42
In Unix, you can nest commands. For example, these should work
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
Posted: 2016-07-24T16:13:48-07:00
by blurymind
Its neat that imagemagick 7 has that command - it would be even better if it can also name the end files properly
Re: Composit 3 images using a single RGB mask
Posted: 2016-07-24T16:23:51-07:00
by fmw42
blurymind wrote:Its neat that imagemagick 7 has that command - it would be even better if it can also name the end files properly
What command are you referring? Name them in what way?
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
Posted: 2016-07-24T17:01:09-07:00
by blurymind
fmw42 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
Code: Select all
magick image1 -set option:mysize "%wx%h" image2 image3 ... imageN -resize "%[mysize]" result.png
You cannot do this in IM 6.
You still have not provided your IM version!
This command
Re: Composit 3 images using a single RGB mask
Posted: 2016-07-24T17:09:06-07:00
by fmw42
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.
Re: Composit 3 images using a single RGB mask
Posted: 2016-07-25T18:45:05-07:00
by fmw42
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:
Code: Select all
magick rose.png -set option:mysize "%wx%h" logo.png netscape.png -set filename:f "%[t]" -resize "%[mysize]" "%[filename:f].png"
or this:
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
Posted: 2016-07-29T07:14:01-07:00
by blurymind
hi, thank you for sharing these. Glad to see IM getting better at this type of thing!!