Search code examples
imagemagickimage-manipulationimagemagick-montage

Combining Images Vertically with a horizontal offset


@ https://superuser.com/questions/290656/combine-multiple-images-using-imagemagick

Reading these posts I was able to join images vertically, however if you see the result ..bottom image needs a slight pixel offset (because its y-axis is 2-figure value as compared to upper image having y-axis of 3-figure, x-axis is same & at constant interval)

If I can just give bottom picture a slight nudge to the right, x-axis will appear more appropriate

Individual images (same dimension) enter image description here enter image description here

Result enter image description here


Solution

  • You could put a little 10 pixel transparent "filler" image to the left of the bottom one like this:

    convert -background none top.png \
      \( -size 10x10 xc:none bottom.png +append \) -append result.png
    

    enter image description here

    I have made the filler green below so you can see it.

    enter image description here

    So, by way of explanation, +append will append side-by-side with the first image on the left and subsequent ones to the right, whilst -append will append top-to-bottom with the first image at the top and subsequent images below.

    If you want to append to the left, or above, use the operators like -reverse to reverse the order of the frames.