Summary
Creates a single raster dataset from multiple bands.
Illustration
Usage
This tool can also create a raster dataset containing subset of the original raster dataset bands. This is useful if you need to create a new raster dataset with a specific band combination and order.
The order that the bands are listed in the Multi-value Input control box will determine the order of the bands in the output raster dataset.
This tool can only output a square cell size.
You can save your output to BIL, BIP, BMP, BSQ, DAT, Esri Grid , GIF, IMG, JPEG, JPEG 2000, PNG, TIFF, MRF, CRF, or any geodatabase raster dataset.
The output raster dataset takes the cell size from the first raster band in the list.
By default, the output raster dataset takes the extent and the spatial reference of the first raster band with a spatial reference in the list. You can change this by setting the output extent and output coordinate system in the Environment Settings.
The following are some examples of why you would want to combine single raster datasets into multiband raster datasets:
- You may have received some satellite data where each band of data is contained in a single file—for example, band1.tif, band2.tif, and band3.tif. To render these raster datasets together to create a color composite, each band needs to be contained within a single raster dataset (for example, allbands.tif).
- You may have several raster datasets of the same area captured at various times. By displaying these raster datasets as a color composite, you can detect change in the area, such as urban growth or cut forests. To create this color composite, each raster dataset needs to be contained as individual bands within a single raster dataset.
- In some cases, the output of an analysis operation is a single-band raster dataset. To do further visual analysis, you may need to combine the outputs by rendering your data as a color composite.
- Combining bands into one raster dataset can help you organize many related single-band rasters.
Syntax
arcpy.management.CompositeBands(in_rasters, out_raster)
Parameter | Explanation | Data Type |
in_rasters [in_rasters,...] | The raster datasets that you want to use as the bands. | Mosaic Dataset ; Mosaic Layer ; Raster Dataset ; Raster Layer |
out_raster | The name, location and format for the raster dataset you are creating. Make sure that it can support the necessary bit-depth. When storing the raster dataset in a file format, you need to specify the file extension:
When storing a raster dataset in a geodatabase, do not add a file extension 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 in the geoprocessing Environments. | Raster Dataset |
Code sample
This is a Python sample for the CompositeBands tool.
import arcpy
from arcpy import env
env.workspace = "c:/data"
arcpy.CompositeBands_management("band1.tif;band2.tif;band3.tif",
"compbands.tif")
This is a Python script sample for the CompositeBands tool.
##====================================
##Composite Bands
##Usage: CompositeBands_management in_rasters;in_rasters... out_raster
import arcpy
arcpy.env.workspace = r"C:/Workspace"
##Compose multi types of single band raster datasets to a TIFF format raster dataset
arcpy.CompositeBands_management("band1.tif;comp.mdb/band2;comp.gdb/bands/Band_3","compbands.tif")
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes