I have scanned a newspaper article which was larger than the scanner glass. Each page was scanned twice: the top and the bottom parts, where the middle part appeared in both images.

Is there a way to quickly match and stitch these scanned images, preferably using CLI? The panorama stitching tools I know require lengthy configuration, which is mostly irrelevant: lens size, focus, angle etc.

Hugin has a solution for this issue, but it isn't practical for batch jobs.

  • 1
    Your "hugin solution for this issue" uses the GUI interface.. hugin-tools has a CLI tool-set.. maybe you can do something with them (unless those CLI tools what you meant by "not practical".. ) – Peter.O Jun 25 '11 at 18:16
  • Any CLI solution is welcome. – Adam Matan Jun 25 '11 at 22:15

You could play around with ImageMagick's montage tool. You'll want to install the imagemagick package before you go any further.

At face value, you just need to ply montage with input files and then give it an output file:

montage scan1.jpg scan2.jpg output.jpg

but montage can get really powerful. You can pass along various translation arguments if you need to rotate the pages before they're combined. You can read an extended manual on it here.

|improve this answer|||||
  • 7
    It simply concatenates images, without smart stitching (matching points, rotating a bit etc.) – Adam Matan Jun 25 '11 at 22:20
  • Beware this command will output a low-resolution file. – marianoju Oct 18 '16 at 12:05

Ok, in really what you need is ImageMagick, install it sudo apt-get install imagemagick and then you just need to do these steps:

  • create a blank image in the parameters to fit the two images that you need to put together.
  • type in the terminal: composite -gravity North top_scan.jpg blank_image.jpg top_image.jpg
  • type in the terminal: composite -gravity South bottom_scan.jpg top_image.jpg complete_image.jpg

But if you need something that autorotate the images to get them perfectly matching, sorry, but as far as I know there isn't anything that do it in ubuntu.

|improve this answer|||||

In CLI, you should look at panorama tools, as Hugin is only a GUI for this software.

|improve this answer|||||
  • Pointing in the right direction, but not an answer to the question. – marianoju Oct 18 '16 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.