ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Copy Raster

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Saves a copy of a raster dataset or converts a mosaic dataset into a single raster dataset.

Usage

  • You can save your output to BIL, BIP, BMP, BSQ, CRF, DAT, Esri Grid, GIF, IMG, JPEG, JPEG 2000, MRF, PNG, TIFF, or any geodatabase raster dataset.

  • When storing a raster dataset in a geodatabase, no file extension should be added to the name of the raster dataset. When storing the raster dataset in a file format, you need to specify the file extension:

    • .bil for Esri BIL
    • .bip for Esri BIP
    • .bmp for BMP
    • .bsq for Esri BSQ
    • .dat for ENVI DAT
    • .gif for GIF
    • .img for ERDAS IMAGINE
    • .jpg for JPEG
    • .jp2 for JPEG 2000
    • .png for PNG
    • .tif for TIFF
    • .mrf for MRF
    • .crf for CRF
    • No extension for Esri Grid

  • This tool can be used to scale your pixel type from one bit depth to another. When you scale your pixel depth, your raster will display the same, but the values will be scaled to the new bit depth that was specified.

  • The output of this tool is always a raster dataset. This tool will accept a mosaic dataset as the input, but the output will still be a raster dataset—the contents of the mosaic dataset will be mosaicked to create a raster dataset.

  • If you checked the Use world file to define the coordinates of the raster option in ArcMap Options, a world file will be written out. If a world file already exists, it will be overwritten. There may also be a half-pixel shift in the output spatial reference.

  • For file-based rasters and personal geodatabase rasters, Ignore Background Value must be set to the same value as NoData for the background value to be ignored. File geodatabase rasters and enterprise geodatabase rasters will work without this extra step.

  • When storing your raster dataset to a JPEG file, a JPEG 2000 file, or a geodatabase, you can specify a Compression Type and Compression Quality in the Environments.

  • The GIF format only supports single-band raster datasets.

  • The Pixel Type parameter determines the bit depth of the output raster dataset. Rescaling of the raster values occurs when a different pixel type is chosen. If the pixel type is demoted (lowered), the raster values outside the valid range for that pixel depth will be truncated and lost. To learn about the bit depth capacity for supported export formats, see Supported raster dataset file formats.

Syntax

CopyRaster(in_raster, out_rasterdataset, {config_keyword}, {background_value}, {nodata_value}, {onebit_to_eightbit}, {colormap_to_RGB}, {pixel_type}, {scale_pixel_value}, {RGB_to_Colormap}, {format}, {transform}, {}, {})
ParameterExplanationData Type
in_raster

The raster dataset or mosaic dataset you want to copy.

Raster Dataset; Mosaic Dataset; Mosaic Layer; Raster Layer; File; Image Service
out_rasterdataset

The name and format for the raster dataset you are creating.

  • .bil—Esri BIL
  • .bip—Esri BIP
  • .bmp—BMP
  • .bsq—Esri BSQ
  • .dat—ENVI DAT
  • .gif—GIF
  • .img—ERDAS IMAGINE
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • .mrf—MRF
  • .crf—CRF
  • No extension for Esri Grid

When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset.

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

Raster Dataset
config_keyword
(Optional)

Specifies the storage parameters (configuration) for a geodatabase. Configuration keywords are set up by your database administrator.

String
background_value
(Optional)

Remove the unwanted values created around the raster data. The value specified will be distinguished from other valuable data in the raster dataset. For example, a value of zero along the raster dataset's borders will be distinguished from zero values within the raster dataset.

The pixel value specified will be set to NoData in the output raster dataset.

For file-based rasters and geodatabase rasters, Ignore Background Value must be set to the same value as NoData for the background value to be ignored. Enterprise and geodatabase rasters will work without this extra step.

Double
nodata_value
(Optional)

All the pixels with the specified value will be set to NoData in the output raster dataset.

String
onebit_to_eightbit
(Optional)

Choose whether the input 1-bit raster dataset will be converted to an 8-bit raster dataset. In this conversion, the value 1 in the input raster dataset will be changed to 255 in the output raster dataset. This is useful when importing a 1-bit raster dataset to a geodatabase. One-bit raster datasets have 8-bit pyramid layers when stored in a file system, but in a geodatabase, 1-bit raster datasets can only have 1-bit pyramid layers, which makes the display unpleasant. By converting the data to 8 bit in a geodatabase, the pyramid layers are built as 8 bit instead of 1 bit, resulting in a proper raster dataset in the display.

  • NONE —No conversion will be done. This is the default.
  • OneBitTo8Bit —The input raster will be converted.
Boolean
colormap_to_RGB
(Optional)

If the input raster dataset has a color map, the output raster dataset can be converted to a three-band output raster dataset. This is useful when mosaicking rasters with different color maps.

  • NONE —No conversion will occur. This is the default.
  • ColormapToRGB —The input dataset will be converted.
Boolean
pixel_type
(Optional)

Set the bit depth, or radiometric resolution, of the raster or mosaic dataset. If not defined, it will be taken from the first raster dataset.

  • 1_BIT —A 1-bit unsigned integer. The values can be 0 or 1.
  • 2_BIT —A 2-bit unsigned integer. The values supported can be from 0 to 3.
  • 4_BIT —A 4-bit unsigned integer. The values supported can be from 0 to 15.
  • 8_BIT_UNSIGNED —An unsigned 8-bit data type. The values supported can be from 0 to 255.
  • 8_BIT_SIGNED —A signed 8-bit data type. The values supported can be from -128 to 127.
  • 16_BIT_UNSIGNED —A 16-bit unsigned data type. The values can range from 0 to 65,535.
  • 16_BIT_SIGNED —A 16-bit signed data type. The values can range from -32,768 to 32,767.
  • 32_BIT_UNSIGNED —A 32-bit unsigned data type. The values can range from 0 to 4,294,967,295.
  • 32_BIT_SIGNED —A 32-bit signed data type. The values can range from -2,147,483,648 to 2,147,483,647.
  • 32_BIT_FLOAT —A 32-bit data type supporting decimals.
  • 64_BIT —A 64-bit data type supporting decimals.
String
scale_pixel_value
(Optional)

When the output is a different pixel type than the input (such as 16 bit to 8 bit), you can choose to have the values scaled to fit into the new range; otherwise, the values that do not fit into the new pixel range will be discarded.

If scaling up, such as 8 bit to 16 bit, the minimum and maximum of the 8-bit values will be scaled to the minimum and maximum in the 16-bit range. If scaling down, such as 16 bit to 8 bit, the minimum and maximum of the 16-bit values will be scaled to the minimum and maximum in the 8-bit range.

  • NONE —The pixel values will remain the same and will not be scaled. Any values that do not fit within the value range will be discarded. This is the default.
  • ScalePixelValue —The pixel values will be scaled to the new pixel type. When you scale your pixel depth, your raster will display the same, but the values will be scaled to the new bit depth that was specified.
Boolean
RGB_to_Colormap
(Optional)

Convert an 8-bit, 3-band (RGB) raster dataset to a single-band raster dataset with a color map. This operation suppresses noise that is often found in scanned images and is ideal for screen captures, scanned maps, or scanned documents. This is not recommended for satellite or aerial imagery or thematic raster data.

  • NONE —Do not convert RGB.
  • RGBToColormap —Convert to color map.
Boolean
format
(Optional)

The output raster format.

  • TIFF —TIFF format
  • COG —Cloud Optimized GeoTIFF format
  • IMAGINE Image —ERDAS IMAGINE
  • BMP —BMP format
  • GIF —GIF format
  • PNG —PNG format
  • JPEG —JPEG format
  • JP2 —JPEG 2000 format
  • GRID —Esri Grid format
  • BIL —Esri BIL format
  • BSQ —Esri BSQ format
  • BIP —Esri BIP format
  • ENVI —ENVI format
  • CRF —CRF format
  • MRF —MRF format
String
transform
(Optional)

Apply the transformation associated with the raster to the output. The input raster can have a transformation associated with it, that is, not actually saved within the input, such as a world file or as a geometric function.

  • NONE —Do not apply any associated transformations to the output.
  • Transform —Apply the associated transformation to the output.
Boolean
(Optional)
(Optional)

Code sample

CopyRaster example 1 (Python window)

This is a Python sample for the CopyRaster tool.

##====================================
##Copy Raster
##Usage: CopyRaster_management(
##			in_raster, out_rasterdataset, {config_keyword}, {background_value}, 
##			{nodata_value}, {NONE | OneBitTo8Bit}, {NONE | ColormapToRGB}, 
##			{1_BIT | 2_BIT | 4_BIT | 8_BIT_UNSIGNED | 8_BIT_SIGNED | 16_BIT_UNSIGNED | 
##			16_BIT_SIGNED | 32_BIT_UNSIGNED | 32_BIT_SIGNED | 32_BIT_FLOAT | 64_BIT}, 
##			{NONE | ScalePixelValue}, {NONE | RGBToColormap}, {TIFF | IMAGINE Image | 
##			BMP | GIF | PNG | JPEG | JPEG2000 | Esri Grid | Esri BIL | Esri BSQ | 
##			Esri BIP | ENVI | CRF | MRF}, {NONE | Transform})

try:
    import arcpy
    arcpy.env.workspace = r"C:\PrjWorkspace"
    ##Copy File RasterDataset to GDB Dataset with Background and Nodata setting
    arcpy.CopyRaster_management("background.tif","CpRaster.gdb\\background","DEFAULTS","0","9","","","8_BIT_UNSIGNED")
    ##Copy 1 BIT 
    arcpy.CopyRaster_management("1bit.tif","SDE94.sde\\bit8","DEFAULTS","","","OneBitTo8Bit","","")
    ##Copy to cloud raster format
    arcpy.CopyRaster_management("slope_elev.tif", "https://s3.amazonaws.com/S3Storage/slope_elev", format="CRF", transform="Transform")
except:
    print "Copy Raster example failed."
    print arcpy.GetMessages()
CopyRaster example 2 (stand-alone script)

This is a Python script sample for the CopyRaster tool.

##====================================
##Usage: CopyRaster_management(
##			in_raster, out_rasterdataset, {config_keyword}, {background_value}, 
##			{nodata_value}, {NONE | OneBitTo8Bit}, {NONE | ColormapToRGB}, 
##			{1_BIT | 2_BIT | 4_BIT | 8_BIT_UNSIGNED | 8_BIT_SIGNED | 16_BIT_UNSIGNED | 
##			16_BIT_SIGNED | 32_BIT_UNSIGNED | 32_BIT_SIGNED | 32_BIT_FLOAT | 64_BIT}, 
##			{NONE | ScalePixelValue}, {NONE | RGBToColormap}, {TIFF | IMAGINE Image | 
##			BMP | GIF | PNG | JPEG | JPEG2000 | Esri Grid | Esri BIL | Esri BSQ | 
##			Esri BIP | ENVI | CRF | MRF}, {NONE | Transform})

import arcpy
arcpy.env.workspace = r"C:\PrjWorkspace"

##Copy to cloud raster format
arcpy.CopyRaster_management(
	"slope_elev.tif", "https://s3.amazonaws.com/S3Storage/slope_elev", 
	format="CRF")

Environments

  • Cell Size
  • Compression
  • Current Workspace
  • Extent
  • Geographic Transformations
  • NoData
  • Output CONFIG Keyword
  • Output Coordinate System
  • Parallel Processing Factor
  • Raster Statistics
  • Resampling Method
  • Scratch Workspace
  • Snap Raster
  • Tile Size

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics

  • An overview of the Raster toolset
  • Environment settings for raster data
  • Supported raster dataset file formats

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2019 Esri. | Privacy | Legal