# imageio.plugins.tifffile

Read/Write TIFF files.

Backend: internal

Provides support for a wide range of Tiff images using the tifffile backend.

## Parameters for reading

offsetint

  Optional start position of embedded file. By default this is the current file position.

sizeint

  Optional size of embedded file. By default this is the number of bytes from the ‘offset’ to the end of the file.

multifilebool

  If True (default), series may include pages from multiple files. Currently applies to OME-TIFF only.

multifile_closebool

  If True (default), keep the handles of other files in multifile series closed. This is inefficient when few files refer to many pages. If False, the C runtime may run out of resources.

## Parameters for saving

bigtiffbool

  If True, the BigTIFF format is used.

byteorder{‘<’, ‘>’}

  The endianness of the data in the file. By default this is the system’s native byte order.

softwarestr

  Name of the software used to create the image. Saved with the first page only.

## Metadata for reading

planar_configuration{‘contig’, ‘planar’}

  Specifies if samples are stored contiguous or in separate planes. By default this setting is inferred from the data shape. ‘contig’: last dimension contains samples. ‘planar’: third last dimension contains samples.

resolution_unitint

  The resolution unit stored in the TIFF tag. Usually 1 means no/unknown unit, 2 means dpi (inch), 3 means dpc (centimeter).

resolution(float, float, str)

  A tuple formatted as (X_resolution, Y_resolution, unit). The unit is a string representing one of the following units:

      NONE        # No unit or unit unknown
      INCH        # dpi
      CENTIMETER  # cpi
      MILLIMETER
      MICROMETER

compressionint

  Value indicating the compression algorithm used, e.g. 5 is LZW, 7 is JPEG, 8 is deflate. If 1, data are uncompressed.

predictorint

  Value 2 indicates horizontal differencing was used before compression, while 3 indicates floating point horizontal differencing. If 1, no prediction scheme was used before compression.

orientation{‘top_left’, ‘bottom_right’, …}

  Oriented of image array.

is_rgbbool

  True if page contains a RGB image.

is_contigbool

  True if page contains a contiguous image.

is_tiledbool

  True if page contains tiled image.

is_palettebool

  True if page contains a palette-colored image and not OME or STK.

is_reducedbool

  True if page is a reduced image of another image.

is_shapedbool

  True if page contains shape in image_description tag.

is_fluoviewbool

  True if page contains FluoView MM_STAMP tag.

is_nihbool

  True if page contains NIH image header.

is_micromanagerbool

  True if page contains Micro-Manager metadata.

is_omebool

  True if page contains OME-XML in image_description tag.

is_sgibool

  True if page contains SGI image and tile depth tags.

is_mdgelbool

  True if page contains md_file_tag tag.

is_mediacybool

  True if page contains Media Cybernetics Id tag.

is_stkbool

  True if page contains UIC2Tag tag.

is_lsmbool

  True if page contains LSM CZ_LSM_INFO tag.

descriptionstr

  Image description

description1str

  Additional description

is_imagejNone or str

  ImageJ metadata

softwarestr

  Software used to create the TIFF file

datetimedatetime.datetime

  Creation date and time

## Metadata for writing

photometric{‘minisblack’, ‘miniswhite’, ‘rgb’}

  The color space of the image data. By default this setting is inferred from the data shape.

planarconfig{‘contig’, ‘planar’}

  Specifies if samples are stored contiguous or in separate planes. By default this setting is inferred from the data shape. ‘contig’: last dimension contains samples. ‘planar’: third last dimension contains samples.

resolution(float, float) or ((int, int), (int, int))

  X and Y resolution in dots per inch as float or rational numbers.

descriptionstr

  The subject of the image. Saved with the first page only.

compressint

  Values from 0 to 9 controlling the level of zlib (deflate) compression. If 0, data are written uncompressed (default).

compressionstr, (int, int)

  Compression scheme used while writing the image. If omitted (default) the image is not uncompressed. Compression cannot be used to write contiguous series. Compressors may require certain data shapes, types or value ranges. For example, JPEG compression requires grayscale or RGB(A), uint8 or 12-bit uint16. JPEG compression is experimental. JPEG markers and TIFF tags may not match. Only a limited set of compression schemes are implemented. ‘ZLIB’ is short for ADOBE_DEFLATE. The value is written to the Compression tag.

compressionargs:

  Extra arguments passed to compression codec, e.g., compression level. Refer to the Imagecodecs implementation for supported arguments.

predictorbool

  If True, horizontal differencing is applied before compression. Note that using an int literal 1 actually means no prediction scheme will be used.

volumebool

  If True, volume data are stored in one tile (if applicable) using the SGI image_depth and tile_depth tags. Image width and depth must be multiple of 16. Few software can read this format, e.g. MeVisLab.

writeshapebool

  If True, write the data shape to the image_description tag if necessary and no other description is given.

extratags: sequence of tuples

  Additional tags as [(code, dtype, count, value, writeonce)].

  codeint

    The TIFF tag Id.

  dtypestr

    Data type of items in ‘value’ in Python struct format. One of B, s, H, I, 2I, b, h, i, f, d, Q, or q.

  countint

    Number of data values. Not used for string values.

  valuesequence

    ‘Count’ values compatible with ‘dtype’.

  writeoncebool

    If True, the tag is written to the first page only.

## Notes

Global metadata is stored with the first frame in a TIFF file. Thus calling `Format.Writer.set_meta_data()` after the first frame was written has no effect. Also, global metadata is ignored if metadata is provided via the meta argument of `Format.Writer.append_data()`.

If you have installed tifffile as a Python package, imageio will attempt to use that as backend instead of the bundled backend. Doing so can provide access to new performance improvements and bug fixes.

previous

imageio.plugins.swf

next

imageio.plugins.tifffile_v3