JPEGFormat

サマリー

The JPEGFormat object represents a collection of Joint Photographic Experts Group (JPEG) file properties that can be configured and used with the export method on the Layout, MapFrame, and MapView objects to create an output JPG file.

説明

JPEG files are compressed image files. They support 24-bit color and have been a popular choice for use on the web because JPEG file size is often substantially smaller than many other image formats. However, the JPEG compression algorithm is lossy and is not recommended for many map images, as line drawings and text or iconic graphics become blurred by compression artifacts. Thus, PNG is usually a superior format for map images. JPEGs can be generated with an accompanying world file for use as georeferenced raster data.

The createExportFormat method can be used to create a JPEGFormat object if the format parameter is set to JPEG. The returned JPEGFormat object contains all the properties associated with a generating a JPEG 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 24-BIT_TRUE_COLOR.

  • 8-BIT_GRAYSCALE256 shades of gray. All colors are converted to grayscale.
  • 24-BIT_TRUE_COLOR16,777,216 possible colors. This option is good for maximum color fidelity.
String
filePath
(読み書き)

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

String
geoReferenceMapFrame
(読み書き)

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

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

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 80.

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

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

方法の概要

方法説明
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_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.
String

コードのサンプル

JPEGFormat example

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

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

jpg = arcpy.mp.CreateExportFormat('JPEG', r'C:\Temp\Output.jpg')

lyt.export(jpg)