TGAFormat

サマリー

The TGAFormat object represents a collection of Truevision Graphics Adaptor (TGA) file properties that can be configured and used with the export method on the Layout, MapFrame, and MapView objects to create an output TGA file.

説明

TGA files have historically been used for content that is meant to be used in other applications (for example, image sprites for animated games) and is read and written by many popular graphic arts applications. It supports multiple bit depths including 32 bit with alpha (transparency) support.

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

プロパティ

プロパティ説明データ タイプ
clipToElements
(読み書き)

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
(読み書き)

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

  • 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_GRAYSCALEUses 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.
  • 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.
String
filePath
(読み書き)

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

String
height
(読み書き)

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
(読み書き)

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

注意:

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

Integer
showSelectionSymbology
(読み書き)

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
transparentBackground
(読み書き)

If set to True, export a transparent page instead of a white page. This property only applies when exporting a Layout object. The default value is False.

注意:

Transparent backgrounds are only supported when colorMode is set to 32-BIT_WITH_ALPHA. This option is not available for maps, but transparency on a map is honored on export.

Boolean
width
(読み書き)

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

方法の概要

方法説明
setColorMode (color_mode)

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

方法

setColorMode (color_mode)
パラメーター説明データ タイプ
color_mode

Below is a list of valid strings.

  • 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_GRAYSCALEUses 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.
  • 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.
String

コードのサンプル

TGAFormat example

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

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

tga = arcpy.mp.CreateExportFormat('TGA', r'C:\Temp\Output.tga')

lyt.export(tga)