Grayscale

Zusammenfassung

Converts a multiband image into a single-band grayscale image. Specified weights are applied to each of the input bands, and a normalization is applied for output.

Auswertung

For more information about how this function works, see the Grayscale raster function.

The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.

Syntax

Grayscale (raster, {conversion_parameters})
ParameterErklärungDatentyp
raster

The input raster.

Raster
conversion_parameters

The weights for each of the bands comprising the input raster.

(Der Standardwert ist None)

List
Rückgabewert
DatentypErklärung
Raster

The output raster.

Codebeispiel

Grayscale example 1

This example applies the Grayscale function to the input imagery.

from arcpy.ia import *
out_grayscale_raster = Grayscale("imagery.tif")
out_grayscale_raster.save("C:/arcpyExamples/outputs/grayscale.tif")
Grayscale example 2

This example applies the Grayscale function to the input imagery.

# Import the system modules
import arcpy
from arcpy.ia import *

# Set the analysis environments
arcpy.env.workspace = "C:/arcpyExamples/data"

# Set the local variables
in_raster = "imagery.tif"

# Execute the Grayscale function
out_grayscale_raster = Grayscale(in_raster)

# Save the output
out_grayscale_raster.save("C:/arcpyExamples/outputs/grayscale.tif")