TIFFFormat

Resumen

The TIFFFormat object represents a collection of Tagged Image File Format (TIFF) file properties that can be configured and used with the export method on the Layout, MapFrame, and MapView objects to create an output TIF file.

Debate

TIFF files are the best choice for importing into image editing applications and are also a common GIS raster data format. However, they cannot be natively viewed by a web browser. TIFFs also support georeferencing information in GeoTIFF tags or in a separate world file for use as raster data.

The createExportFormat method can be used to create a TIFFFormat object if the format parameter is set to TIFF. The returned TIFFFormat object contains all the properties associated with a generating a TIFF file. These properties can be modified accordingly to produce different output results.

Propiedades

PropiedadExplicaciónTipo de datos
clipToElements
(Lectura y escritura)

If set to True, include the areas of the page that have map or layout element content only, rather than exporting the entire page. This property only applies when exporting a Layout object. The default value is False.

Boolean
colorMode
(Lectura y escritura)

A string constant that represents the number of bits to describe color in a pixel. The default value is 24-BIT_TRUE_COLOR.

  • 1-BIT_MONOCHROME_THRESHOLD 2 possible colors, black and white. The areas which are white and black are determined by the threshold value.
  • 8-BIT_ADAPTIVE_PALETTEUses 256 of the most commonly-used pixel colors in the image’s palette, thereby minimizing the number of pixels whose color may change during output.
  • 8-BIT_GRAYSCALE 256 shades of gray. All colors are converted to grayscale.
  • 24-BIT_TRUE_COLOR 16,777,216 possible colors. This option is good for maximum color fidelity.
  • 32-BIT_WITH_ALPHA 16,777,216 possible colors and an alpha (transparency) channel of 255 values. This option is useful for maps or layouts with transparency.
  • 32-BIT_CMYK_TRUE_COLOR 8 bits per pixel for each channel: cyan, magenta, yellow, black.
  • 40-BIT_CMYK_WITH_ALPHA 8 bits per pixel for each channel: cyan, magenta, yellow, black, plus an additional 8-bit channel for alpha. Use this option if maps or layouts have transparency.
Nota:

The available colorMode values are dependent on the specified color model set in color management properties.

The 32-BIT_CMYK_TRUE_COLOR and 40-BIT_CMYK_WITH_ALPHA options are only available if the layout or map has a CMYK color model. Similarly, the 24-BIT_TRUE_COLOR and the 32-BIT_WITH_ALPHA options are only available if the layout or map has a RGB color model.

String
embedColorProfile
(Lectura y escritura)

Include the color profile set for the map or layout in the exported file. This helps create consistency in colors when the file is viewed on different devices. If the profile is not embedded, or a non-color-managed viewer is used, the colors may be significantly different than what is seen on-screen. The default value is True.

Nota:

This option is only available when color management is enabled. If color management is not enabled and the colorspace is set to CMYK, the CMYK colorspace is still included in the export. This may cause some colors to appear differently when viewing the exported file.

Boolean
filePath
(Lectura y escritura)

A string that represents the system path and file name, including the extension, for the exported file.

String
geoReferenceMapFrame
(Lectura y escritura)

The MapFrame used to control the coordinate system when the worldFile property is set to True. The default value is None.

MapFrame
geoTIFFTags
(Lectura y escritura)

If set to True and a valid georef_mapframe is set, geoTIFF tags will be embedded in the resulting image based on the map frame's coordinate system. This allows the exported image to be used as raster data in ArcGIS Pro or other GIS applications. The default value is False.

Nota:

When exporting a layout, the GeoTIFF information needs to be based on a 2D map associated with the geoReferenceMapFrame property.

The geoTIFFTags property is independent from the worldFile property. With GIS-capable software, you can honor the GeoTIFF information or the world file for these exports.

Boolean
height
(Lectura y escritura)

The height, in pixels, of the map area to be exported. This property only applies when exporting a MapView object. The default value is 960.

Double
imageCompression
(Lectura y escritura)

A string constant that represents the compression scheme used to compress image or raster data in the output file. The default value is LZW.

  • DEFLATE Lossless compression method that works well for most cases.
  • JPEG Lossy compression method that works well for photographic-type images.
  • LZW Lossless compression method using a code table.
  • NONECompression is not applied.
  • PACK_BITS Lossless compression method that works well if there are large areas of the same color.
String
imageCompressionQuality
(Lectura y escritura)

The amount of image compression applied to the export. Low quality has a smaller file size but less clear data; max quality has a larger file size but crisper data. This only applies when certain compression types are used. The default value is 100.

Integer
resolution
(Lectura y escritura)

The effective dpi of the output vector data. The default value is 96.

Nota:

When exporting a MapView, the dpi is calculated automatically using system dpi scaling and therefore this value will be ignored.

Integer
showSelectionSymbology
(Lectura y escritura)

Show selected features in the map or map frame as selected in the output file. Setting this value to False does not affect selection within the view, only in the output file. The default value is False.

Boolean
threshold
(Lectura y escritura)

Image intensities set above this value will appear white in the output file and all other values will appear black. This property is applied only when the colorMode property is set to 1-BIT_MONOCHROME_THRESHOLD. The default value is 128.

Boolean
transparentBackground
(Lectura y escritura)

If set to True, the white page background is set to transparent. The default value is False.

Boolean
width
(Lectura y escritura)

The width, in pixels, of the map area to be exported. This property only applies when exporting a MapView object. The default value is 960.

Double
worldFile
(Lectura y escritura)

If set to True and a valid georef_mapframe is set, a world file will be generated based on the map frame's coordinate system. The default value is False.

Boolean

Descripción general del método

MétodoExplicación
setColorMode (color_mode)

A string constant that represents the number of bits used to describe color.

setImageCompression (image_compression)

A string constant that represents the compression scheme used to compress image or raster data in the output file.

Métodos

setColorMode (color_mode)
ParámetroExplicaciónTipo de datos
color_mode

Below is a list of valid strings.

  • 1-BIT_MONOCHROME_THRESHOLD 2 possible colors, black and white. The areas which are white and black are determined by the threshold value.
  • 8-BIT_ADAPTIVE_PALETTEUses 256 of the most commonly-used pixel colors in the image’s palette, thereby minimizing the number of pixels whose color may change during output.
  • 8-BIT_GRAYSCALE 256 shades of gray. All colors are converted to grayscale.
  • 24-BIT_TRUE_COLOR 16,777,216 possible colors. This option is good for maximum color fidelity.
  • 32-BIT_CMYK_TRUE_COLOR 8 bits per pixel for each channel: cyan, magenta, yellow, black.
  • 32-BIT_WITH_ALPHA 16,777,216 possible colors and an alpha (transparency) channel of 255 values. This option is useful for maps or layouts with transparency.
  • 40-BIT_CMYK_WITH_ALPHA 8 bits per pixel for each channel: cyan, magenta, yellow, black, plus an additional 8-bit channel for alpha. Use this option if maps or layouts have transparency.
Nota:

The available colorMode values are dependent on the specified color model set in color management properties.

String

The 32-BIT_CMYK_TRUE_COLOR and 40-BIT_CMYK_WITH_ALPHA options are only available if the layout or map has a CMYK color model. Similarly, the 24-BIT_TRUE_COLOR and the 32-BIT_WITH_ALPHA options are only available if the layout or map has a RGB color model.

setImageCompression (image_compression)
ParámetroExplicaciónTipo de datos
image_compression

Below is a list of valid strings.

  • DEFLATE Lossless compression method that works well for most cases.
  • JPEG Lossy compression method that works well for photographic-type images.
  • LZW Lossless compression method using a code table.
  • NONECompression is not applied.
  • PACK_BITS Lossless compression method that works well if there are large areas of the same color.
String

Muestra de código

TIFFFormat example

The following script exports a layout to TIFF format using default property values.

p = arcpy.mp.ArcGISProject('current')
lyt = p.listLayouts()[0]

tif = arcpy.mp.CreateExportFormat('TIFF', r'C:\Temp\Output.tif')

lyt.export(tif)