# Pto2mk

hugin is effectively an editor of .pto project files, the actual stitching of the panorama is performed by a number of other tools such as nona, enblend, enfuse, hugin_hdrmerge and exiftool. The advantage of this is that the hugin GUI can be closed during stitching, saving memory, or reused to work on the next project - Stitching can also be paused, deferred or shifted to another machine, even 'headless' servers can be used.

The stitching process is not necessarily linear, some operations can be performed in any order and even in parallel, with lots of intermediary files that need to be cleaned-up afterwards. So the process of managing this is handled by w:make (software) a robust and lightweight scriptable tool.

All this is concealed from the user when using the hugin GUI, hugin_stitch_project or the hugin Batch Processor to stitch a project. However the process can also be controlled on the command-line with the pto2mk tool.

First create a Makefile containing all the rules necessary to stitch the project:

      pto2mk -o myproject.pto.mk -p myproject myproject.pto

Then run the stitching process and clean-up afterwards like so:

      make -f myproject.pto.mk all clean

## make options

make supports a large number of options, variables can be overridden by appending them to the command:

      make -f myproject.pto.mk ENBLEND='enblend -l 29' ENFUSE='enfuse -l 29'

make is capable of identifying rules than can be performed in parallel, so for a 16 core system this command will stitch using 16 parallel processes:

      make -j 16 -f myproject.pto.mk NONA='nona -t 1'

For more advanced command-line stitching, a tool like distmake will manage a queue of Makefile stitching jobs, and even load-balance multiple machines over a network.

Retrieved from "http://wiki.panotools.org/Pto2mk"