Difference between revisions of "TIFF"

From PanoTools.org Wiki
Jump to navigation Jump to search
m
(finished)
Line 1: Line 1:
The Tagged Image File Format is a widely used and open [[Image format]] used to store and exchange digital images of all kinds. General information on TIFF on Wikipedia: [http://en.wikipedia.org/wiki/TIFF]
+
The Tagged Image File Format is a widely used and open [[Image format]] used to store and exchange digital images of all kinds. General information on TIFF see Wikipedia page: [http://en.wikipedia.org/wiki/TIFF]
  
 
TIFF is a very versatile file format with many flavors.  
 
TIFF is a very versatile file format with many flavors.  
  
== Compression issues ==
+
=== Compression issues ===
 
TIFF can contain almost any image data. However, there are some common forms of image data compression found inside a TIFF file:
 
TIFF can contain almost any image data. However, there are some common forms of image data compression found inside a TIFF file:
 
* '''No compression''' is the most compatible form but results in the largest files.
 
* '''No compression''' is the most compatible form but results in the largest files.
 
* '''JPEG''' Simply a [[JPEG]] file stored inside a TIFF tag, lossy compression.
 
* '''JPEG''' Simply a [[JPEG]] file stored inside a TIFF tag, lossy compression.
* '''LZW''' is a very common, lossles compression scheme resulting in smaller files. '''LZW''' was patented in most countries until 2004 and hence was not found in many freeware distributions.
+
* '''LZW''' is a very common, lossless compression scheme resulting in smaller files. '''LZW''' was patented in most countries until 2004 and hence was not found in many freeware distributions.
* '''ZIP''' is lossles too but not very common although it usually results in smaller files than LZW and was not patented.
+
* '''ZIP''' is lossless too but not very common although it usually results in smaller files than LZW and was not patented.
 
* '''PackBits''' A not very common, lossless compression scarcely supported by image editing software. [[Photoshop]] for example can read PackBits compressed TIFFs but not write them.
 
* '''PackBits''' A not very common, lossless compression scarcely supported by image editing software. [[Photoshop]] for example can read PackBits compressed TIFFs but not write them.
 
* '''G3''' and '''G4''' compression is used for FAX documents only.
 
* '''G3''' and '''G4''' compression is used for FAX documents only.
  
PTStitcher (and hence all GUIs like [[hugin]], [[PTAssembler]], [[PTGui]] or [[PTMac]]) outputs PackBits compressed image files if the output format is TIFF. There is a bug in [[Photoshop]] prior to Version 9 (CS2) that prevents to open PackBits compressed files beyond a ertain size. See [[Opening large TIFFs with Photoshop]] for details.
+
PTStitcher (and hence all GUIs like [[hugin]], [[PTAssembler]], [[PTGui]] or [[PTMac]]) outputs PackBits compressed image files if the output format is TIFF. There is a bug in [[Photoshop]] prior to Version 9 (CS2) that prevents to open PackBits compressed files beyond a certain size. See [[Opening large TIFFs with Photoshop]] for details.
  
(to be continued)
+
=== Bit depth ===
 +
TIFF can contain data of varying bit depth but for photographic purpose only 8 bit or 16 bit per channel are of interest. However, there is a specification that contains 32 bit data per channel floating point format for High [[Dynamic Range]] images.
 +
 
 +
There can be any number of channels. Common examples are
 +
* a single channel specifying a black-and-white image
 +
* three channels specifying a color image in [[RGB]] color space
 +
* four channels specifying a color image in [[CMYK]] color space.
 +
* any number of additional channels (called alpha channels) specifying masks, selections, additional color channels or what ever.
 +
 
 +
All channels in an image have the same bit depth, hence a [[RGB]] image with 16 bit per channel often is reffered to as a 48 bit image, with 8 bit per channel as a 24 bit image.
 +
 
 +
The Panotools main applications process 16 bit per channel images. Details see [[Full 16 bit workflow]]
 +
 
 +
=== Alpha channels and masks ===
 +
Alpha channels are used by panotools to store masks. A mask contains information to which extent the  image should be used. For this purpose the alpha channel contains a black-and-white image where the  pixel value determines the transparency of the corresponding image pixel.
 +
 
 +
A white alpha channel pixel causes the corresponding image pixel to be seen to 100%, a black alpha channel pixel indicates a totally transparent image pixel. A alpha channel pixel with 50% gray indicates 50% transparency.
 +
 
 +
This is particularily useful to blend between images. [[PTStitcher]], the main stitching application of the [[Panorama Tools]], is capable of reading and writing masked TIFF image files in RGB color space. A mask in the source image is treated as image border and remapped to the output image accordingly.
 +
 
 +
* If the output type 'without feather' (TIFF_m) is used, a mask is created that reflects the remapped input image borders.
 +
 
 +
* For the 'with feather' (TIFF_mask) output the mask is calculated to give a seam between adjacent images that lies more or less in the middle of the overlap area. There is a 'feather' parameter to control the width of a grayscale gradient to allow for smooth blending between the images. See PTStitcher sample script on Jim Watters page for details: [http://photocreations.ca/panotools/stitch.txt]
 +
 
 +
In any case there is a problem to use this alpha channels as intended in [[Photoshop]], since Photoshop does not know about the intended use. It loads the alpha channel but doesn't use it to control transparency. This can be achieved manually by loading the alpha channel as selection and creating a mask with 'reveal selection'. Erik Krause provides a Photoshop action set on his page that can be used to automate this for all images in a panorama: [http://www.erik-krause.de/ttt/index.htm#Importiere%20TIFF%20Dateien]
 +
 
 +
=== Non-image data ===
 +
Since TIFF is a tagged format it can contain additional non-image data either comparable to the [[EXIF]] data in [[JPEG]] files or other. [[Photoshop]] for example inserts XML formatted data that causes warning messages in some programs based on the common TIFF libraries. At least some of the [[EXIF]] tools can be used to view and/or manipulate the corresponding data in TIFF files, too.
 +
 
 +
=== Tools and sources ===
 +
Although the major image processors and viewers cope very well with TIFF it might be necessary from time to time to use some other tools - for batch processing, for conversion of scarcely supported TIFF flavors or simply to get enhanced information.
 +
* '''TIFF tools''' - A free package available from libtiff.org: [http://libtiff.org/] Windows executables at the Gnu Win32 Project: [http://gnuwin32.sourceforge.net/packages/libtiff.htm]
 +
* '''ImageMagick''' command line image processing package: [http://imagemagick.org/]
 +
* '''TIFF libraries''' and specification from libtiff.org: [http://libtiff.org/]
 +
 
 +
<small>--[[User:Erik Krause|Erik Krause]] 17:00, 5 Jul 2005 (EDT)</small>

Revision as of 23:00, 5 July 2005

The Tagged Image File Format is a widely used and open Image format used to store and exchange digital images of all kinds. General information on TIFF see Wikipedia page: [1]

TIFF is a very versatile file format with many flavors.

Compression issues

TIFF can contain almost any image data. However, there are some common forms of image data compression found inside a TIFF file:

  • No compression is the most compatible form but results in the largest files.
  • JPEG Simply a JPEG file stored inside a TIFF tag, lossy compression.
  • LZW is a very common, lossless compression scheme resulting in smaller files. LZW was patented in most countries until 2004 and hence was not found in many freeware distributions.
  • ZIP is lossless too but not very common although it usually results in smaller files than LZW and was not patented.
  • PackBits A not very common, lossless compression scarcely supported by image editing software. Photoshop for example can read PackBits compressed TIFFs but not write them.
  • G3 and G4 compression is used for FAX documents only.

PTStitcher (and hence all GUIs like hugin, PTAssembler, PTGui or PTMac) outputs PackBits compressed image files if the output format is TIFF. There is a bug in Photoshop prior to Version 9 (CS2) that prevents to open PackBits compressed files beyond a certain size. See Opening large TIFFs with Photoshop for details.

Bit depth

TIFF can contain data of varying bit depth but for photographic purpose only 8 bit or 16 bit per channel are of interest. However, there is a specification that contains 32 bit data per channel floating point format for High Dynamic Range images.

There can be any number of channels. Common examples are

  • a single channel specifying a black-and-white image
  • three channels specifying a color image in RGB color space
  • four channels specifying a color image in CMYK color space.
  • any number of additional channels (called alpha channels) specifying masks, selections, additional color channels or what ever.

All channels in an image have the same bit depth, hence a RGB image with 16 bit per channel often is reffered to as a 48 bit image, with 8 bit per channel as a 24 bit image.

The Panotools main applications process 16 bit per channel images. Details see Full 16 bit workflow

Alpha channels and masks

Alpha channels are used by panotools to store masks. A mask contains information to which extent the image should be used. For this purpose the alpha channel contains a black-and-white image where the pixel value determines the transparency of the corresponding image pixel.

A white alpha channel pixel causes the corresponding image pixel to be seen to 100%, a black alpha channel pixel indicates a totally transparent image pixel. A alpha channel pixel with 50% gray indicates 50% transparency.

This is particularily useful to blend between images. PTStitcher, the main stitching application of the Panorama Tools, is capable of reading and writing masked TIFF image files in RGB color space. A mask in the source image is treated as image border and remapped to the output image accordingly.

  • If the output type 'without feather' (TIFF_m) is used, a mask is created that reflects the remapped input image borders.
  • For the 'with feather' (TIFF_mask) output the mask is calculated to give a seam between adjacent images that lies more or less in the middle of the overlap area. There is a 'feather' parameter to control the width of a grayscale gradient to allow for smooth blending between the images. See PTStitcher sample script on Jim Watters page for details: [2]

In any case there is a problem to use this alpha channels as intended in Photoshop, since Photoshop does not know about the intended use. It loads the alpha channel but doesn't use it to control transparency. This can be achieved manually by loading the alpha channel as selection and creating a mask with 'reveal selection'. Erik Krause provides a Photoshop action set on his page that can be used to automate this for all images in a panorama: [3]

Non-image data

Since TIFF is a tagged format it can contain additional non-image data either comparable to the EXIF data in JPEG files or other. Photoshop for example inserts XML formatted data that causes warning messages in some programs based on the common TIFF libraries. At least some of the EXIF tools can be used to view and/or manipulate the corresponding data in TIFF files, too.

Tools and sources

Although the major image processors and viewers cope very well with TIFF it might be necessary from time to time to use some other tools - for batch processing, for conversion of scarcely supported TIFF flavors or simply to get enhanced information.

  • TIFF tools - A free package available from libtiff.org: [4] Windows executables at the Gnu Win32 Project: [5]
  • ImageMagick command line image processing package: [6]
  • TIFF libraries and specification from libtiff.org: [7]

--Erik Krause 17:00, 5 Jul 2005 (EDT)