Multi-Layer TIFF editing with GIMP

From PanoTools.org Wiki
Revision as of 02:40, 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.
  • Open the multi-layer TIFF in the Gimp, version 2 or later.
  • For any layers which need alpha editing, right-click on the layer, and choose Add Layer Mask, selecting Transfer layer's alpha channel.
  • After all masks are edited, choose Script-Fu->Utils->Save Layers as Individual TIFFs. The files will be saved as file000.tif, etc. Note that all layer masks will be applied, and the layers 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.