Resample (Data Management)

Summary

Alters the raster dataset by changing the cell size and resampling method.

Usage

Syntax

Resample_management (in_raster, out_raster, {cell_size}, {resampling_type})
ParameterExplanationData Type
in_raster

The input raster dataset.

Raster Layer
out_raster

The output raster dataset.

When storing the raster dataset in a file format, you need to specify the file extension:

  • .bil—ESRI BIL
  • .bip—ESRI BIP
  • .bmp—BMP
  • .bsq—ESRI BSQ
  • .dat—ENVI DAT
  • .gif—GIF
  • .img—ERDAS IMAGINE file
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • no extension—ESRI GRID

When storing a raster dataset in a geodatabase, no file extension should be added to the name of the raster dataset.

When storing your raster dataset to a JPEG file, a JPEG 2000 file, a TIFF file, or a geodatabase, you can specify a compression type and compression quality.

Raster Dataset
cell_size
(Optional)

The cell size for the new raster dataset.

Analysis cell size
resampling_type
(Optional)

The resampling algorithm to be used. The default is NEAREST.

  • NEARESTNearest neighbor assignment
  • BILINEARBilinear interpolation
  • CUBICCubic convolution
  • MAJORITYMajority resampling
String

Code Sample

Resample example 1 (Python window)

This is a Python sample for the Resample tool.

import arcpy
arcpy.Resample_management("c:/data/image.tif", "c:/data/resampled.tif",
                          "10", "CUBIC")
Resample example 2 (stand-alone script)

This is a Python script sample for the Resample tool.

##====================================
##Resample
##Usage: Resample_management in_raster out_raster {cell_size} {NEAREST | BILINEAR | CUBIC | MAJORITY}

try:
    import arcpy
    arcpy.env.workspace = r"C:/Workspace"
    
    ##Resample TIFF image to a higher resolution
    arcpy.Resample_management("image.tif", "resample.tif", "10", "CUBIC")

except:
    print "Resample example failed."
    print arcpy.GetMessages()

Environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes

10/27/2014