VGMaps

General Boards => Mapping Tips/Guides => Topic started by: denilsonsa on November 24, 2023, 05:10:17 am

Title: Python code to stitch together many screenshots
Post by: denilsonsa on November 24, 2023, 05:10:17 am
As part of the creation of one specific map, I wrote a Jupyter Notebook (https://jupyter.org/) with some Python code (https://docs.python.org/3/tutorial/index.html) to try to semi-automatically crop and align and stitch screenshots. The code isn't perfect, but worked well enough for my needs. It may require a lot of RAM and a lot of patience if you have too many screenshots.

Here → https://gist.github.com/denilsonsa/2922060be4fcddcf7a4e3745a78b5752 ← here!

This notebook is provided as-is. It requires tinkering to make it work! You need to adapt it to your own needs.

If you want to use it, go ahead! No support is provided. Make sure you have Python on your machine, and you know how to use it. It is wise to use virtual environments (https://docs.python.org/3/library/venv.html) to install additional packages. Jupyter is optional (you can just use Python code by itself) but recommended, as it provides a very nice notebook interface that aids with debugging and viewing images.

The provided notebook includes the following functions:

The end result of the code was an OpenRaster (https://en.wikipedia.org/wiki/OpenRaster) image that can be loaded in GIMP (https://www.gimp.org/). Afterwards I did some manual cleaning up. Since there were many overlapping layers of screenshots, it was easy to discard one of the screenshots in favor of another (due to different animation frames on each screenshot, or any similar issue).

Enjoy!