Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".

IM has no single command that will do this. But scripts can be written, and some of my pages have scripts for aligning by different methods.

Your problem has no unique solution, of course. For example, the images could overlap so the right-side of the first image (which is white) matches any white area on the left of the second image.

The two images can be trimmed to remove the white space, so there is only one solution. This can be found slowly by a brute-force search, or more quickly by making a Gaussian pyramid from each, and doing a small-space brute force search at each level.

An alternative technique is to trim the white off one image, then crop the four margins from that. Each margin could be, say, 20 pixels high or wide. Search for each margin within the other image. With luck, one of the margins (and only one) is found within the other image. For example:

Your problem has no unique solution, of course. For example, the images could overlap so the right-side of the first image (which is white) matches any white area on the left of the second image.

If we specify that overlaps must happen, and in the content where it is distinguishable, the first image will never be at the right, top or bottom of the second. If would be mandatory that at least two different colors match and try to overlap as much as possible in case letters repeat. But maybe wasn't the best example, if we get images that can only overlap in a single position you can easily tell by the eye.

There are several things to keep in mind though about this and other software you recommended:

- FFmpeg is mainly for video manipulation so no use here.

- ImageMagick is oriented for single-picture manipulation only, so not much use here either.

- Microsoft Image Composite Editor (ICE) is a pain in the ass to use and does not auto-detect the position of each picture. It's horrible.

- Hugin is great but requires you a lot of work to reference pictures spatially, so it is very tedious when you have dozens of pictures to manipulate. Furthermore it's not easy to automate because of that.

- cv::Stitcher from OpenCV is the best, however requires a lot of overlap, otherwise the following error will be thrown:

However I would point out that a calculated FX solution while 'not as simple' will also let you append with overlap a whole sequence of images. All the offsets are relative to the previous image (using its calculated position and size). This works for any images, or any (and variable) size, and in any direction! This is wny it is a more 'general' solution.

In this case next image is overlaps by 8 pixels then moved down 4 pixels.