23

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.

2
  • 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
5
+50

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.

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

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.

1
0

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

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

I would use convert from imagemagick

if you see the 2 examples below and play around it will be VERY easy to do what you requested [you may have to make 2 then stitch those]:

NOTA BENE: -append gives your vertical and +append horizontal -geometry allows you to state what size your final image ...

convert *.JPG -append -geometry 1920x1200 final.jpg

convert hey.png hey2.png hey3.png +append final.png

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.