Dammit Jim, I'm a photographer not a computer expert! I have tried to use GIMP's Auto-Image-Alignment plug-in and everything's there but I just do not get how it works! I have 100 pictures of our garden in different seasons, all taken from the same exact spot, but subtle shifts in the camera placement make the animated version of these images too jittery to watch. I was hoping the auto-align plug-in for GIMP would solve my problems, but I just do not get how it works. I've been tring for like three weeks now. Can some kind soul PUH-LEEZE just write down the steps for you you would align and crop and save, say, 100 similar but slightly misaligned photos?

  • 3
    Hmmm, why not use align_image_stack? Like GIMP, it's free of charge, but for alignment it is much much easier to use, much faster, more accurate, and also works with 16 bit images. You just download the Hugin panorama stitcher and then copy the align_image_stack.exe program to a directory that you want to use for alignment. – Count Iblis Sep 25 '15 at 20:36
  • 2
    The UI in GIMP is worth what you paid for it. It's a common failing in open source applications that the UI is terrible. @CountIblis - care to make that an answer? – James Snell Sep 25 '15 at 21:40
  • Is your end goal a timelapse video? The video.SE may have more help, if that's the case. – inkista Sep 26 '15 at 1:04

A better way to align images is by using the align_image_stack program, which is part of the free of charge Hugin panorama stitcher program. To align images, you can copy the align_image_stack.exe file to some directory where you put your images im1.tif, im2.tif, etc. You then open a command prompt and type the command:

align_image_stack -a al -t 0.3 -c 20 im1.tif im2.tif im3.tif...

Here the -a al option specifies the prefix of the output files as "al"; the aligned images will then be al0000.tif, al0001.tif, etc. The -t 0.3 specifies the maximum misalignment to be 0.3 pixels; the default value is 3 pixels (in your case you may need to choose a larger value, e.g. 1). The -c 20 option specifies the number of control points in each of the 5 by 5 subdivisions of the pictures to be 20; the default value is 8. You can change the number of subdivisions using the -g option. Due to the remapping, the aligned output files won't have perfect overlap anymore. You can crop them to have maximum overlap using the -C option.

For a large number of input images, you don't want to let align_image_stack find the optimal cropping using the -C option, as the computation will take long. Another potential problem is that the alignment is done in the specified order, and control points are only added to pairs of images that are neighbors in the stack. When you have more than a few images, the alignment will start to drift, as the remapping is only accurate to within some tolerance. There will be a random walk away from perfect alignment with the first image. So, when image 100 is aligned with image 99, you can bet that it won't be well aligned with image 1.

To deal with this problem it's best to use Hugin to add control points to pairs of images that are removed far away from each other in the stack. You can do that by first running align_image_stack with the extra option -p test.pto. If you then start up Hugin and load the test.pto project, you'll see all the input images and all the control points that have been added by align_image_stack. You can then choose the to add control points for the pair consisting of the first and the last image, and a few more, e.g. each pair ten places away in the stack. You can also remove bad control points that have been placed on features that are not stationary.

  • Interesting, I've only used align_image_stack for focus/exposure stacking, didn't realize it was a viable option for time lapses... does it not get confused by the features that change in a timelapse stack? – junkyardsparkle Sep 27 '15 at 5:23
  • 1
    @junkyardsparkle Yes, there is the possibility of bad control points slipping in, that's another reason why it's better to put in the -p debug.pto option and check with Hugin if the control points are ok. Another defense against that is to choose the maximum misalignment with the -t option to be small, say 0.5 pixels. Also, by choosing many control points with the -c option, a few bad control points won't have much impact. – Count Iblis Sep 27 '15 at 15:25

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