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.
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: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.Ok, in really what you need is ImageMagick, install it
sudo apt-get install imagemagick
and then you just need to do these steps:composite -gravity North top_scan.jpg blank_image.jpg top_image.jpg
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.
In CLI, you should look at panorama tools, as Hugin is only a GUI for this software.
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 ...