TIFF (.tiff, .tif)

Background & Context

    • Registered MIME type: image/tiff
    • TIFF raster image format.
    • Commonly used in image manipulation applications, page layout applications, scanners and other imaging devices, and for the archiving of images.
    • Suitable for high-color-depth images.
    • TIFF is an acronym for Tagged Image File Format.
    • Binary format.
    • Supports multiple color resolutions, color encodings, color palettes, and compression methods.
    • Supports floating-point images with 32 and 64 bits per channel.
    • Can store multiple images.
    • Supports alpha channels.
    • Introduced in 1986 by Aldus.

Import & Export

  • Import["file.tiff"] imports a TIFF file, returning a single Image object or a list of images.
  • Import["file.tiff",elem] imports the specified element from a TIFF file.
  • The import format can be specified with Import["file","TIFF"] or Import["file",{"TIFF",elem,}].
  • Export["file.tiff",expr] exports an image, graphics, or any other expression as an image to a TIFF file.
  • Export["file.tiff",{expr1,expr2,}] exports a list of expressions as a multi-image TIFF file.
  • Export["file.tiff",Manipulate[]] exports a list of frames from an animated demonstration of a Manipulate object.
  • Image objects are by default exported at their full raster size. Graphics and other arbitrary expressions are exported using the same raster size as their displayed form.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the TIFF format.

Notebook Interface

  • In the notebook front end, Insert Picture and the Open menu allow import of a TIFF file into a cell.
  • Save Selection As exports the selected part of a notebook as a TIFF file.

Import Elements

  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Data representation elements:
  • "ColorMap"color reduction palette
    "Data"array of pixel values
    "Graphics"the first image in the file, given as graphics
    "Image"first image in the file, represented as an Image object
    "RawData"array of color map indices
    {"Thumbnail",size}thumbnail of the first image (default size = Small)
  • Data representation elements for multi-image TIFF files:
  • "Animation"multi-image TIFF represented as an animation object
    "Image3D"images in the file, represented as an Image3D object
    {"GraphicsList",frames}images as a list of graphics (default frames=All)
    {"ImageList",frames}a list of images (default frames=All)
    {"ThumbnailList",frames,size}a list of thumbnails (default frames=All, size=Small)
  • Import by default uses "Image" for single-frame TIFF files and "ImageList" for multi-frame TIFF files.
  • Import of a multi-image TIFF with element "Graphics" or "Image" gives the first image.
  • Export by default generates a multi-image TIFF if the expression supplied is a list of Graphics or Image objects.
  • Export with element "Graphics" or "Image" always generates a single-image TIFF.
  • Advanced Import elements:
  • "BitDepth"bits used to represent each color channel in the file
    "CameraTopOrientation"
  • orientation of the camera when the picture was taken
  • "Channels"
  • the number of color channels used in the file
  • "ColorProfileData"embedded color profile, given as a ColorProfileData object
    "ColorSpace"color encoding used in the file
    "FlashUsed"
  • whether the flash was fired
  • "GeoPosition"
  • latitude and longitude represented as GeoPosition object
  • "GPSDateTime"
  • image creation date and time registered by GPS
  • "ImageCount"number of images in the file
    "ImageEncoding"how images are compressed in the file
    "ImageResolution"image resolution specified in the file
    "ImageSize"raster dimensions
    "Summary"
  • summary of the file
  • "SummarySlideView"slide view summary of all frames
  • Metadata elements:
  • "Exif"formatted Exif (Exchange image file format)
    "IPTC"formatted IPTC (International Press Telecommunications Council)
    "XMP"formatted XMP (Extensible metadata platform)
  • Raw metadata, as stored in the file, can be imported using "RawExif", "RawXMP", and "RawIPTC" elements, returned as an association.
  • All Exif and IPTC tags can be imported individually. Common tags include:
  • "ApertureValue"lens aperture
    "DateTime"image creation date and time
    "ExposureTime"exposure time, given in seconds
    "FNumber"F number
    "FocalLength"actual focal length of the lens, given in millimeters
    "Make"manufacturer of the recording equipment
    "Model"model name or model number of the equipment
    "Software"name and version of the software or firmware of the camera or image input device used to generate the image
  • For multi-image TIFF files, the above data representation and metadata elements are taken to be lists of the respective expressions.

Options

  • Import and Export options:
  • ImageResolutionAutomaticresolution used for rendering the graphics
    ImageSizeAutomaticoverall image size
    IncludeMetaInformationAllmetadata types to import and export
    "ImageTopOrientation"Automaticorientation of the image as stored in the file
  • Import option:
  • "TakeRows"{1,-1}rows to import
  • Export options:
  • ByteOrdering-1ordering of bytes in the file
    "BitDepth"Automaticbit depth per channel used to store image data
    "ColorMapLength"Automaticnumber of colors to use for quantization
    "ColorSeparation"Falsewhether to store color channels in separate planes
    "ColorSpace"Automaticcolor encoding to be used in the file
    CompressionLevelAutomaticcompression level, given as a number between 0 and 1
    Dithering"FloydSteinberg"dithering algorithm used for generating the color-reduction table
    "DifferencingPredictor"Falsewhether to use horizontal differencing when using LZW or ZIP compression
    "ImageEncoding"Nonehow images are compressed in the file
    "QuantizationMethod"Automatica method to use for quantization
  • Export["file.tiff",expr] creates a TIFF image with the same image size as the displayed form of expr.
  • Supported "ColorSpace" settings are: "Grayscale", "RGB", "CMYK", and "LAB".
  • Supported "BitDepth" settings are: Automatic, 1, 8, 16, 32, and 64.
  • By default, "Bit" images are exported to 1-bit, "Byte" images are exported to 8-bit, and other types are exported to 16-bit TIFF files.
  • The following settings for "ImageEncoding" are supported:
  • Noneno compression
    "JPEG"lossy JPEG compression
    "LZW"lossless LZW compression
    "PackBits"PackBits run-length encoding method
    "ZIP"lossless ZIP image data compression
  • Detailed properties and settings for exporting a Manipulate:
  • "ControlAppearance""Generic"how Manipulate control elements are rendered in the exported file
  • The following settings can be given for "ControlAppearance":
  • Automaticcaptures user controls exactly as seen in the notebook interface, using the style elements of the local computer system
    "Generic"renders graphical controls in a generic style
    Noneexcludes control elements when exporting an animation

Examples

open allclose all

Basic Examples  (5)

This imports a TIFF example file, rendering it as an Image:

Summary of the image:

Export an image to TIFF:

Import a multi-frame TIFF file as an animation:

Create a multi-frame TIFF file from a list of images:

Scope  (9)

Show all elements available in the file:

Available Exif elements:

Available IPTC elements:

Import image metadata:

Export a binary image:

Export a real-valued RGB image:

Export a Lab image:

Generate a TIFF file with meta-information:

Create a TIFF file from data representation elements:

Create a multi-frame TIFF file from a list of RGB images:

Create a multi-frame TIFF from a Manipulate:

Read the number of exported frames:

Import Elements  (37)

Available Elements  (5)

List of available elements:

List of available Exif elements:

List of available IPTC elements:

Get image-related information as list of rules:

Import some image options:

The "Options" element does not return all options that are present in the imported image:

Data Representation  (10)

"Animation"  (1)

Get the animation of the frames:

"Data"  (1)

Import the image data:

Create an image from imported data:

"Graphics"  (1)

Import as a Graphics object:

"Image"  (2)

Import the file as an Image object:

Importing as an "Image" gets only the first frame of a multi-frame file:

"Image3D"  (1)

Multi-frame TIFF files with commensurate properties can get imported as an Image3D:

"ImageList"  (2)

Get the data as a list of Image objects:

This is the default import element for TIFF:

Specify the frames to import:

"Thumbnail"  (1)

Import a thumbnail of an image:

Specify the thumbnail size:

"ThumbnailList"  (1)

Import a list of thumbnails of a multi-framed image:

Specify the thumbnail size:

Metadata  (22)

"BitDepth"  (1)

Get the bit count for the representation of each color channel:

"CameraTopOrientation"  (1)

Get the camera orientation at the capture time:

"Channels"  (1)

Get the number of color channels used:

"ColorProfileData"  (1)

Get the embedded color profile, given as a ColorProfileData object:

The color profile is stored in the ColorSpace option of the imported image:

"ColorSpace"  (1)

Get the color encoding used on export:

Use ImageColorSpace to get the color space of an imported image:

"DateTime"  (1)

Get the data and time that the image was captured:

"Exif"  (3)

Get Exif metadata:

Extract an individual tag from the association:

Individual Exif tags can also be imported directly:

Some Exif tags are processed to give more detailed information:

Compare with the raw "Orientation" tag:

"GeoPosition"  (1)

The image geo position may be unavailable:

"GPSDateTime"  (1)

Get the image creation date and time registered by GPS:

"ImageCount"  (1)

Get the number of frames in a multi-frame TIFF file:

"ImageEncoding"  (1)

Get the encoding of a TIFF image:

"ImageSize"  (1)

Get the dimensions of the image stored in the file:

Using ImageDimensions on an imported image gives the same result:

"IPTC"  (1)

Get IPTC metadata:

"RedEyeCorrection"  (1)

Whether a red-eye correction was performed:

"RawExif"  (1)

Import unprocessed Exif metadata:

Extract one element:

Compare to the processed element:

"RawIPTC"  (1)

Import unprocessed IPTC metadata:

"RowsPerStrip"  (1)

Get the number of rows per strip:

"Summary"  (1)

Get the image summary:

"SummarySlideView"  (1)

Get the image frames' summary:

"XMP"  (1)

Get XMP metadata:

Extract the XMP "DublinCoreSchema" metadata:

Import Options  (7)

ImageResolution  (1)

By default, the image resolution is extracted from the file:

Specify the resolution of the imported image:

Specify different resolutions in and directions:

ImageSize  (1)

By default, images are imported in their full resolution:

Specify the raster size of the imported JPEG image:

Specify both width and height of the imported image:

"ImageTopOrientation"  (1)

By default, images are imported with the native orientation stored in the file:

Specify the side that is supposed to be on the top:

The correct orientation can also be achieved by rotating the image after import:

IncludeMetaInformation  (3)

By default, all available metadata is imported:

All imported classes of metadata:

Import the image with no metadata:

Import the image with Exif metadata only:

"TakeRows"  (1)

By default, all rows are imported:

Import only the specified rows:

Export Options  (12)

"BitDepth"  (2)

By default, the exported TIFF file has a bit depth of 16:

Specify a different bit depth:

Export real valued lists to TIFF:

"ColorSpace"  (1)

By default, the native color space of the image is used for export:

Export as a CMYK image:

CompressionLevel  (1)

By default, with some image encodings, an automatic compression level is used:

Specify the compression level:

Compare the file size for different compression levels:

"ControlAppearance"  (1)

Control the appearance of a multi-frame TIFF from a Manipulate:

By default, the controls are also included:

Export without controls:

"ColorMapLength"  (1)

Decrease the file size by specifying a smaller length of a color map:

Dithering  (1)

Show the effect of dithering:

Show the areas with significant difference:

"ImageEncoding"  (1)

By default, the image encoding is None:

Specify an encoding:

ImageSize  (1)

By default, the image is exported in the full resolution:

Specify the raster size of exported image:

"ImageTopOrientation"  (1)

By default, the upright image is exported using "ImageTopOrientation"->Top:

Specify the orientation:

Import using the appropriate top orientation:

IncludeMetaInformation  (1)

By default, all available metadata is exported:

Specify the metadata to include:

Export no metadata:

Some metadata may automatically get generated:

"QuantizationMethod"  (1)

Show the effect of various quantization methods:

Show the areas with significant difference:

Introduced in 1999
 (4.0)
 |
Updated in 2018
 (11.3)