ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMRasterColorizer Class / Contrast Property
Example

In This Topic
    Contrast Property (CIMRasterColorizer)
    In This Topic
    Gets or sets the contrast value.
    Syntax
    public int Contrast {get; set;}
    Public Property Contrast As Integer
    Example
    Update the raster colorizer on a raster layer
    {
      await QueuedTask.Run(() =>
      {
        // Get the colorizer from the raster layer.
        CIMRasterColorizer rasterColorizer = rasterLayer.GetColorizer();
        // Update raster colorizer properties.
        rasterColorizer.Brightness = 10;
        rasterColorizer.Contrast = -5;
        rasterColorizer.ResamplingType = RasterResamplingType.NearestNeighbor;
        // Update the raster layer with the changed colorizer.
        rasterLayer.SetColorizer(rasterColorizer);
      });
    }
    Update the raster colorizer on a mosaic layer
    {
      await QueuedTask.Run(() =>
      {
      // Get the image sub-layer from the mosaic layer.
      ImageMosaicSubLayer mosaicImageSubLayer = mosaicLayer.GetImageLayer();
      // Get the colorizer from the image sub-layer.
      CIMRasterColorizer rasterColorizer = mosaicImageSubLayer.GetColorizer();
      // Update raster colorizer properties.
      rasterColorizer.Brightness = 10;
      rasterColorizer.Contrast = -5;
      rasterColorizer.ResamplingType = RasterResamplingType.NearestNeighbor;
      // Update the image sub-layer with the changed colorizer.
      mosaicImageSubLayer.SetColorizer(rasterColorizer);
      });
    }
    Update the raster colorizer on an image service layer
    {
      await QueuedTask.Run(() =>
      {
      // Get the colorizer from the image service layer.
      CIMRasterColorizer rasterColorizer = imageServiceLayer.GetColorizer();
      // Update the colorizer properties.
      rasterColorizer.Brightness = 10;
      rasterColorizer.Contrast = -5;
      rasterColorizer.ResamplingType = RasterResamplingType.NearestNeighbor;
      // Update the image service layer with the changed colorizer.
      imageServiceLayer.SetColorizer(rasterColorizer);
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also