Robert Pollak
Robert Pollak

Reputation: 4173

ImageMagick montage: Resizing only one input image

I am currently using the following to combine several (e.g. two) images:

montage a.png b.png -geometry +5+5 -tile 2x1 out.png

I can resize the first image to 200% before the images are combined:

montage a.png -resize 200% b.png -geometry +5+5 -tile 2x1 out.png

However, the following resizes both images:

montage a.png b.png -resize 200% -geometry +5+5 -tile 2x1 out.png

Is there a way within this single command to just resize b.png to 200% before the combination takes place?

Upvotes: 0

Views: 1554

Answers (2)

Mark Setchell
Mark Setchell

Reputation: 208107

You can use parentheses to apply operations selectively, like this:

montage blue.png \( red.png -resize 200% \) -geometry +5+5 -tile 2x1 out.png

You may, or may not, need the slashes in front to escape them depending on your shell/environment.

Here is how it looks:

convert -size 30x30! xc:red red.png
convert -size 30x30! xc:blue blue.png

and your original command:

montage blue.png red.png -geometry +5+5 -tile 2x1 out.png

enter image description here

but with selective enlargement as follows:

montage blue.png \( red.png -resize 200% \) -geometry +5+5 -tile 2x1 out.png

enter image description here

Very French, I feel :-)

Upvotes: 4

rostok
rostok

Reputation: 2137

try resizing during image read with modifier added in square brackets:

montage a.png b.png"[200%]" -geometry +5+5 -tile x1 out.png

details: http://www.imagemagick.org/Usage/resize/#read

it is also worth mentioning that you can also crop image while reading

Upvotes: 2

Related Questions