Is there a tool in Ubuntu to automatically merge two images having a common strip? I need to scan a large image, which will not fit at once in the scanner. I was thinking about scanning it in two parts and hand-editing the result in Gimp to join them. But probably an automatic tool can do the same more quickly and better.

EDIT I think I may have not made my point clear. My difficulty is not aligning two images. My problem is that one has to compensate for the rotation or distortion introduced by the manual process of putting the sheet into the scanner, and an automatic tool should obtain more precise results at analyzing common patterns in the two images to rotate and align them seamlessly.


Using the tools provided with ImageMagick

Install via the software center

We can easily join, i.e. "montage" images into one large image with the following command

montage -geometry 500 image1 image2 [...] output

See the project page for many parameters of the geometry option. CAUTION: the output argument is non-optional, having just two images on argument list ends up replacing image2 without warning. In the example above all images will be scaled to a width of 500 pixels before they are joined. Adapt this value for your image sizes. In case you need to have a fixed height choose x500 instead. The other dimension will be scaled to preserve the aspect ratio.


Inspired by this post saying that ImageMagick has command line tool named convert to merge images. To join images horizontally (in alphabetical order):

convert +append *.png out.png 

To stack images vertically:

convert -append *.png out.png

That should be run in a terminal into the folder containing png files to join them all.

A gui for that would be:

a file manager context menu to join selected images.

An easy way when it comes to that is Thunar's custom actions:

To join selected images vertically (into one png file, in alphabetical order, no matter their extension) add this custom action:

convert -append %F joined-vertical.png

To join horizontally:

convert +append %F joined-horizontal.png

For a more sophisticated way to assemble images you may want to search for panorama photo stitcher software such as hugin Install hugin

Install via the software center

or the Pandora plugin for Gimp.


You can easily achieve that with Gimp.

1)Make a new file File->New

At the "create new image" dialog add the desired height and width.That will give you your new file which may look like this (depending on the dimensions you set) :

2)Open the two images you want to merge from File -> Open...

3)Then click copy at the image Edit -> Copy...

4)Go to the empty file you created first at step 1 and paste the images (Copy and paste the first image and then copy and paste the second) Edit -> Paste

5)Position the two images using the "Move" option from the Toolbox

When the pasted image is where you want it, set it in place. Either move your cursor on the canvas until you see a little anchor symbol, or click "Layer" on the Toolbar, then select "Anchor":

6)Scale the new file with the two merged pictures Image -> Scale Image...