I've been trying to understand ImageMagick's image stack. Here's my understanding:
Whenever you reference an image on the command line, you add an image to the stack. Certain operators can pop multiple images off the stack and push a result image, such as +append or -composite. For example:
convert a.png b.png -composite output.png
This composites b on top of a, as expected.
But when I run this (I know it doesn't make sense, but I'm trying to understand the behavior):
convert a.png -composite b.png output.png
I get a picture consisting of just b.png. Why is that? Where did the first image go? Wouldn't you expect this to error since composite doesn't have two images to work with?
In addition, if I run this,
convert -composite a.png b.png output.png
I get the same result as if I ran a.png b.png -composite. Why is this? Wouldn't you expect this to also error?
This confuses me because I expect malformed inputs to throw errors rather than producing unexpected output. How do I avoid issues like these when working with ImageMagick?