A Python tool that stitches overlapping photos into a single panorama at full resolution. Pick a folder of images, pick where to save the result, done.
-
Folder pop-ups: choose the input folder and the output folder in a dialog.
-
No quality loss: images are never downscaled, warping uses Lanczos interpolation, and the result is saved as lossless PNG.
-
Order independent: every image is matched against every other one, so the file names or shooting order do not matter.
-
Accurate alignment: SIFT features, RANSAC homography estimation, then a global optimisation over all matches.
-
Best model wins: five alignment models are scored on the same matches (alignment error and pixel-density stretch) and the best one is used:
Model Idea homography-chainone homography per neighbour pair, chained homography-globalall homographies refined together cylindercamera-rotation model on a cylinder spherecamera-rotation model on a sphere cylinder+localrotation model plus a small homography fix per image -
Clean joins: automatic seam finding, per-image exposure matching and multi-band blending avoid ghosting and visible edges.
Python 3.9+ is recommended (tkinter ships with the standard Windows/macOS
installers; on Linux install python3-tk).
pip install -r requirements.txtpython panorama.pyTwo dialogs open: first the folder with your photos, then the folder to save
into. The panorama is written as panorama.png.
Without dialogs (handy for scripts):
python panorama.py path/to/images path/to/outputSupported inputs: .jpg .jpeg .png .tif .tiff .bmp.
- Detect SIFT features in every image and match every pair.
- Keep pairs with enough consistent matches (RANSAC homography) and build a maximum spanning tree to decide the stitching order.
- Build the five alignment models, score each one and keep the best.
- Warp every image at native pixel density, find seams, match exposure and blend with multi-band blending.
The code in panorama.py is split into small, commented
functions following these steps.
Sample photos are in examples/. Try:
python panorama.py examples/test2 output| Input folder | Images | Preview |
|---|---|---|
examples/test1 |
2 | examples/results/test1.jpg |
examples/test2 |
5 | examples/results/test2.jpg |
examples/test3 |
3 (mixed resolution) | examples/results/test3.jpg |
Previews are resized JPEGs; the program itself writes full-resolution PNG.
- Photos should be taken from (nearly) the same spot. Large camera movement with nearby objects causes parallax that can leave small seam artifacts.
- Very large inputs produce very large panoramas (capped at 150 megapixels).
- Black borders are empty canvas and are not cropped, so no image content is lost.
MIT, see LICENSE.
