How to stitch two images together

Can supplement Kuba's nice answer with a geometric transform from the documentation.

 {w, h} = ImageDimensions[img2];
{e, tr} = FindGeometricTransform[img1, img2];
tmp = ImagePerspectiveTransformation[img2, tr, DataRange -> Full, 
   PlotRange -> {{0, First@tr[{w, 0}]}, {0, h}}];
ImageCompose[tmp, {img1, 1}, Round@({w, h}/2)]

yielding:

enter image description here


Is this what you need?

padded = ImagePad[img1, {{#, #}, {#2, #2}} & @@ ImageDimensions@img2];
aligned = ImageAlign[padded, img2];


ImageCrop @ ImageCompose[padded, aligned]

enter image description here

Padding may be expensive for ImageAlign so if you know where it should fit you can pad from one or two sides not around.