Page 1 of 1

Where does each parameter/argument go?

Posted: 2012-08-23T07:30:19-07:00
by green_meep
Hey all,

Bit of a noobish question here, but I'd like to know where each argument goes. For example, I spent hours finding a command that did something simple like masking an image with a black and white mask:

Code: Select all

convert foo.png mask.png -alpha off -compose copy_opacity -composite bar.png
Foo.png makes sense to be right after convert, because it's the image in question. What is mask.png doing there, though? I would have thought that it would make more sense to be after copy_opacity, because that's where I'm asking IM to use mask.png. Basically, when and how do I know where to put each argument? Is there something I'm missing?

Thanks in advance.

Re: Where does each parameter/argument go?

Posted: 2012-08-23T09:58:04-07:00
by fmw42

Re: Where does each parameter/argument go?

Posted: 2012-08-27T23:53:07-07:00
by anthony
In the above case as long as the two images are in that order, and all five image/settings are done before the -composite operator, it will work correctly.

The key point is that all 4 operations: 2 image reads, the composite, and the final 'implied' write; is done in the right order, and the settings appropriate for each is done before the operator that uses it (only composite is using the settings).



Why did I include the implied write? Because it is an operation that (for convert at least) is always performed, UNLESS you use "null:" on the end.

In a IMv7 magick command (which relaces "convert"), there is an implied write for the command line - just like "convert", but not when "magick" reads its arguments from a file "script". In file/pipelined scripts you need a explicit -write to save the final image.