I made a few serial shots (at a rate of roughly 5 shots per second) using a new macro lens without image stabilizer or tripod. The original idea was that the small shake of hand could be used in combination for focus stacking.

According to the situation the images should have 3D rotation as well as 3D translation; despite of that the subject may have moved with the wind also.

My first series had been using the electronic shutter, and the shots seem to suffer from a significant rolling shutter effect, so I tried to use those shot with the mechanical shutter.

First I tried to align them using different layers in difference mod in GIMP, but failed to align them to the degree I had wished for. So I tried align_image_stack -v -t160 -m -a test- 9574.JPG 9575.JPG 9576.JPG following Pat David: Focus Stacking Macro Photos (Enfuse), but the result failed as well.

I'll present an example that failed significantly with the original images; however for size reasons I'm presenting scaled-down images here:

First the original (scaled) images: #9574 (scaled down) #9575 (scaled down) #9576 (scaled down)

Exiftool reports these metadata for the images (edited for shortness):

Common for all shots:
Exposure Time                   : 1/125
F Number                        : 9.0
Exposure Program                : Aperture-priority AE
ISO                             : 200
Focal Length In 35mm Format     : 130 mm

Time Since Power On             : 00:02:57.68
Roll Angle                      : 0.3
Pitch Angle                     : -9.3
Accelerometer Z                 : 260
Accelerometer X                 : 4
Accelerometer Y                 : 63

Time Since Power On             : 00:02:57.84
Roll Angle                      : 0.3
Pitch Angle                     : -9.3
Accelerometer Z                 : 260
Accelerometer X                 : 4
Accelerometer Y                 : 63

Time Since Power On             : 00:02:58.05
Roll Angle                      : 0.3
Pitch Angle                     : -9.3
Accelerometer Z                 : 260
Accelerometer X                 : 4
Accelerometer Y                 : 63

Maybe the metadata related to angle and acceleration wasn't updated for serial shots, however.

Then the output of align_image_stack -v -t48 -m -a out- _1090574.JPG _1090575.JPG _1090576.JPG for the original images (also scaled down): output of full-scale #9574 (scaled down) output of full-scale #9575 (scaled down) output of full-scale #9576 (scaled down)

You should see that the result is even worse than the original shots.

Interestingly when aligning the scaled-down shots, the result is not as terrible as for the original shots, but still not what I had hoped for: output for #9574 output for #9575 output for #9576

Well, I should note that my version of align_image_stack came from Hugin 20.20.0.

Basically I'd like to know what causes the failure, or in other words: What it needed to make alignment succeed?


When I used the Hugin GUI and "align image stack" I was able to get better results, but it was not obvious to me which tool and which parameters were actually used to get it.

Also (as written in the comment), I was able to get an acceptable result from Affinity Photo.

  • \$\begingroup\$ [not an answer, just a musing…] I've never tried stacking in Gimp, but tbh, Photoshop isn't great at it either. For that reason I moved to Zerene Stacker years ago. It had no issues with your first 3 size reduced images at all. It's hard to tell exactly how it's improved things because the images are a bit small, but it did the job in about 5 seconds, no manual adjustment necessary. I've had to convert the result from tif to jpg to upload here - i.stack.imgur.com/E6H5k.jpg \$\endgroup\$
    – Tetsujin
    Jan 2, 2022 at 17:25
  • \$\begingroup\$ I tried Affinity Photo (1.9.2), and there the individual shots seem to be corrected correctly, too. Most notably you see the blurred background move while the foreground stays at place. Maybe that's where align_image_stackhas a problem. \$\endgroup\$
    – U. Windl
    Jan 2, 2022 at 19:18

2 Answers 2


When stacking (and stitching)...

  1. Decide what you want to achieve.

    • Increase depth of field?
    • Remove unwanted people or objects?
    • Reduce noise?
    • HDR?
    • Increase resolution? (This doesn't really work unless you have a camera with pixel shift.)
  2. Shooting conditions:

    • Use a tripod.
    • Bracket (exposure, focus, etc), if needed.
  3. Control points:

    • Make sure they are on the subject of interest.
      • When removing people, make sure there are no control points on the people.
      • In your sample, it looks like you're mainly interested in the berry (?).
    • Make sure the points are accurate.
      • The -t flag reduces accuracy of the control points. (Avoid it.)
      • Use the -p flag to create .pto files so you can review the control points in Hugin. Or just use Hugin directly. For your set of images, the CPFind+Celeste method works well.
      • Review the control points to remove extraneous points. Then optimize positions and barrel distortion.



As U. Windl stated, the background and subject are moving relative to another which may confuse align_image_stack. Try doing the alignment in Hugin where you have control of the control points.

Auto-generate control points and, in the Control Points tab, delete the control points on the background so you only have control points on the subject.

Check Combined stacks: Exposure fused stacks in the Stitcher tab.

In the Processing section, check Image fusion: and manually enter the parameters for focus stacking in options:

--exposure-weight=0 --saturation-weight=0 --contrast-weight=1 --hard-mask

I tried this on your samples and the process didn't do anything amiss. However, I couldn't see any benefit doing the focus stacking, perhaps due to the scaled down images.

  • \$\begingroup\$ Well, those were my first attempts with the new lens and it seems none of the images were perfectly sharp, most likely because of the relation of handshake vs. focal length and shutter speed. \$\endgroup\$
    – U. Windl
    Jan 2, 2022 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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