I need to append two images horizontally, that is, on the left and on the right sides, and to add space between them. Here is what I use currently for this:
magick montage input1.png input2.png -geometry +10+0 output.png
But there is a problem: -geometry +10+0
adds space not only on the inner side, but also on the outer side.
magick -size 100x150 xc:red image1.png
magick -size 100x150 xc:gree image2.png
magick montage input1.png input2.png -geometry +10+0 output.png
(The border is added for clarity.)
Whereas what I want it
I can achieve it using -trim
, but -trim
is not really convenient for some images, e.g. if the images are book pages, and you don't want to remove their margins. So I wonder whether this can be achieved using -geometry
instead. Is it possible?
Use +smush N
where N is the width of the gap in pixels:
magick red.png green.png +smush 10 result.png
Use -smush N
to stack above/below instead of side-by-side.
Set -background blue
before "smushing" to make the gap blue.
Use a negative N to overlap your images.