Multi-Layer TIFF editing with GIMP

From PanoTools.org Wiki
Revision as of 03:17, 9 October 2006 by Jdsmith (talk | contribs)
Jump to navigation Jump to search

Hugin, and its associated stitcher nona can output multi-layer TIFF files, in which all remapped images are arranged in layers with appropriate offsets. These compact TIFF files are useful for visualizing and editing alpha masks, for instance to exclude moving objects or troublesome stitch areas, prior to passing to enblend for final blending. Gimp can read, but not write these multi-layer TIFF files, and enblend cannot read them. Another compact output option is a Cropped TIFF. Multi-layer TIFFs are simply a collection of cropped TIFFs in a single file. tiffsplit (a TIFF Tools program) can split a multi-layer file into separate cropped TIFF images, prior to running enblend.

Unfortunately, no editors (except Cinepaint) preserve the offset information in Cropped TIFFs, which means enblend cannot use them after any editing (it will stack them all on top of each other). An option for making use of multi-layer TIFFs is available with the Gimp script save-layers-tiff. This script saves all layers, applying any alpha masks, to full size (non-cropped) images, which enblend can accept. To install, simply drop in ~/.gimp-2.2/scripts/ (or whatever version of Gimp you are running).

The recommended workflow is then:

  • Output to multi-layer TIFF using Hugin.
  • Open the resulting multi-layer TIFF in the Gimp, version 2 or later.
  • Edit the alpha channel by erasing undesired areas (disabling view of all but 2 layers, and reducing the opacity of the upper layer can be useful here). You can also transfer the alpha channel to a layer mask for more fine-tuned editing.
  • After all masks are edited, choose Script-Fu->Utils->Save Layers as Individual TIFFs. The files will be saved as file000.tif, etc., for an input file file.tif. Note that any layer masks will be applied (converted back into alpha channels), and the layers themselves will be expanded to the full image size.
  • Run enblend, like enblend -wzo file.tif file[0-9]*.tif.
  • (Optionally) remove the fileXXX.tif files, and save the multi-layer TIFF in a format which can preserve your edits, e.g. Gimp's native format, file.xcf. You can then safely delete the multi-layer TIFF.

Note that if no alpha mask editing is needed, it will be faster to use tiffsplit to split the multi-layer tiff into individual cropped TIFFs, and pass those to enblend.