Compression (Environment setting)

Tools that honor the Compression environment setting will set the compression type when storing output raster datasets.

The primary benefits of compressing data are that compressed data requires less storage space, and data display times will be quicker because there is less information to transmit.

ArcGIS can store compressed data in the following formats: IMG, JPEG, JPEG 2000, TIFF, Grid, file geodatabase, personal geodatabase, and ArcSDE geodatabase. When storing data in the geodatabase, the blocks of data are compressed before they are stored.

Data compression can be lossy (JPEG and JPEG 2000) or lossless (LZ77, PackBits, CCITT). Lossless compression means that the values of cells in the raster dataset are not changed or lost. You should choose lossless or no compression if the pixel values of the raster dataset will be used for analysis or deriving other data products.

The amount of compression will depend on the data and compression quality. The more homogeneous the data, the higher the compression ratio. The lower the compression quality, the higher the compression ratio. Lossy compression normally results in higher compression ratios when compared to lossless compression.

Usage notes

Dialog syntax

Scripting syntax

arcpy.env.compression = "compression_type {value}"

Parameters

Explanation

compression_type (Required)

  • LZ77—Lossless compression that preserves all raster cell values. This is the default.
  • JPEG—Lossy compression that uses the public JPEG compression algorithm. If you choose JPEG, you can also specify the compression quality value. This compression can be used for JPEG files, TIFF files, and geodatabases.

    The valid compression quality value ranges are from 0 to 100, with 75 being the default.

  • JPEG2000—Uses wavelet technology so rasters appear lossless. If you choose JPEG2000, you can also specify the compression quality value. This compression can be used for JPEG 2000 files and geodatabases.

    The valid compression quality value ranges are from 0 to 100, with 75 being the default.

  • PackBits—PackBits compression for TIFF files.
  • LZW—Lossless compression that preserves all raster cell values.
  • RLE—Run length encoding for IMG files.
  • CCITT_G3—Lossless compression for 1-bit data.
  • CCITT_G4—Lossless compression for 1-bit data.
  • CCITT_1D—Lossless compression for 1-bit data.
  • NONE—No compression will occur.
  • VALUE

value (Optional)

When JPEG or JPEG2000 compression is chosen, the compression quality also needs to be specified. The valid compression quality value ranges are from 1 to 100, with 75 being the default.

compression syntax
import arcpy

# Set the compression environment to LZ77.
arcpy.env.compression = "LZ77"

# Set the compression environment to JPEG with a quality of 80.
arcpy.env.compression = "JPEG 80"

Related Topics


3/13/2012