GIFFormat

Synthèse

The GIFFormat object represents a collection of Graphic Interchange Format (GIF) file properties that can be configured and used with the export method on the Layout, MapFrame, and MapView objects to create an output GIF file.

Discussion

GIF files are a legacy raster format for use on the web. GIFs cannot contain more than 256 colors (8 bits per pixel), which, along with optional lossless RLE or LZW compression, makes them smaller than other file formats. GIF files can also define a transparent color. GIFs can be generated with an accompanying world file for use as georeferenced raster data.

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

Propriétés

PropriétéExplicationType de données
clipToElements
(Lecture et écriture)

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
(Lecture et écriture)

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

  • 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.
String
filePath
(Lecture et écriture)

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

String
geoReferenceMapFrame
(Lecture et écriture)

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

MapFrame
height
(Lecture et écriture)

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
resolution
(Lecture et écriture)

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

Remarque :

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

Integer
showSelectionSymbology
(Lecture et écriture)

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
(Lecture et écriture)

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
width
(Lecture et écriture)

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
(Lecture et écriture)

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

Vue d’ensemble des méthodes

MéthodeExplication
setColorMode (color_mode)

A string constant that represents the number of bits to describe color in a pixel.

Méthodes

setColorMode (color_mode)
ParamètreExplicationType de données
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.
String

Exemple de code

GIFFormat example

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

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

gif = arcpy.mp.CreateExportFormat('GIF', r'C:\Temp\Output.gif')

lyt.export(gif)