Where does each parameter/argument go?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
green_meep
Posts: 4
Joined: 2012-08-23T07:23:28-07:00
Authentication code: 67789

Where does each parameter/argument go?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Where does each parameter/argument go?

Post by fmw42 »

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Where does each parameter/argument go?

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply