I have two different pictures of the same object, one of which is taken from roughy the same angle but has a different scale and rotation. I want both images to overlap so that the upper one matches the lower one as exactly as possible. Is there any option in gimp where I can define a number of key points and gimp aligns the images according to these points? For example I say that corner X in picture 1 has to match corner Y in picture 2. It should be sufficient to define 3 such points in each image to get a good result already.

If it is not possible, what would be the best way to reach this goal aside from just scaling and rotating until it looks ok?

up vote 3 down vote accepted

I don't believe there is anything in Gimp to auto align images.

You can do it manually by putting the images in layers, setting the top opacity so you can see the underlying image and scaling/rotating one of them.

Or you can use a tool like Enfuse

  • Thank you, this might do the trick. The manually aligning with half opacity is what I did before, but that still is quite difficult, when the picture is also rotated... – janoliver Jan 20 '12 at 10:13

It looks like panotools has a Gimp plugin. I haven't used it, but it's there.

Outside of GIMP, but still free, you might want to try going down different roads.

Hugin - Primarily targetted at panorama stitching, you can use this to align and scale an image stack for HDR or exposure blending or time-lapse videos or...

Registax - Aimed at astrophotographers, this free software will take multiple images (a few stand-alone or thousands of video frames), rotate, scale, and align them. Beyond that, it can (optionally) use very sophisticated techniques to combine the component images into a final image.

HDR Alignment Tool - Another possibility. It does alignment, rotation, and scaling. Might be worth a try. A comparison to Photomatix auto-alignment (in 2007, mind you) seems to favor HDRAT.

DeShaker - Another way to approach aligning smaller images (up to 1080p resolution), this free software does video stabilization. If you were to combine the two images into a two-frame movie, this would align them. Probably not what you want, but it's a technique that's been used for aligning still images.

  • Good recommendations btw. I didn't have much time to investigate them all, however, the HDR Align was quite basic and straight forward to use and it did the job. You gotta define couple of points manually though to help the scale. – Mehrad Mar 30 '16 at 2:12

You can use Filter|G'MIC|Layers|Align Layers. You must select Input Layers: All before executing. Take into account that this is a time consuming operation.

I just did this in Gimp with no additional software. This method will easily and precisely produce the "3 point scale, rotate, translate" that you asked about. If there's other perspective issues though, one of the other methods in the other answers will be required.

  1. Both images in their own layer. Select the ruler.

  2. Show Layer1/Image1, measure between two points. Click and drag from one point to another, then zooom in and move the endpoints for more precision. This gives you the exact measurement to a tenth of a pixel and the rotation angle. The further apart the points, the better. Let's call it Length1.

  3. Show Layer2/Image2. Adjust endpoints to match the same reference points. Let's call it Length2.

  4. 100 * (Length1/Length2) = The scale percentage you need to apply to Image2.

  5. Rotate as needed, as indicated by the difference in rotation angles.

  6. It's a simple matter to move one image over the other.

click file>>>open as layers>>>select both of the images that you want to merge.

click on the larger image, and click on the scale tool. Scale the larger image down to fit on the smaller image.

Set the top layer's opacity down to a lower number so you can see how the two are aligning, kind of like it's done in this gimp video tutorial on beer: http://gimpedblog.blogspot.com/2011/12/in-this-gimp-tutorial-im-going-to-show.html

use the move, rotate, and perspective tools to adjust the two photos into place.

crop the extra canvas area out with the crop tool.

  • 3
    Hi Alex. Welcome to Stack Exchange, and thank you for your contributions — hope to see more of you. Pointing to a tutorial you made is very helpful. You can't, however, advertise your services in your answers. See photo.stackexchange.com/faq#promotion – mattdm Jan 21 '12 at 15:23

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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