ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMRasterRGBColorizer Class / StretchType Property
Example

In This Topic
    StretchType Property (CIMRasterRGBColorizer)
    In This Topic
    Gets or sets the stretch type.
    Syntax
    public RasterStretchType StretchType {get; set;}
    Public Property StretchType As RasterStretchType
    Example
    Update the RGB colorizer on a raster layer
    {
      await QueuedTask.Run(() =>
      {
        // Get the colorizer from the raster layer.
        CIMRasterColorizer rColorizer = rasterLayer.GetColorizer();
        // Check if the colorizer is an RGB colorizer.
        if (rColorizer is CIMRasterRGBColorizer rasterRGBColorizer)
        {
          // Update RGB colorizer properties.
          rasterRGBColorizer.StretchType = RasterStretchType.ESRI;
          // Update the raster layer with the changed colorizer.
          rasterLayer.SetColorizer(rasterRGBColorizer);
        }
      });
    }
    Update the RGB 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 rColorizer = mosaicImageSubLayer.GetColorizer();
      // Check if the colorizer is an RGB colorizer.
      if (rColorizer is CIMRasterRGBColorizer rasterRGBColorizer)
      {
        // Update RGB colorizer properties.
        rasterRGBColorizer.StretchType = RasterStretchType.ESRI;
        // Update the image sub-layer with the changed colorizer.
        mosaicImageSubLayer.SetColorizer(rasterRGBColorizer);
      }
      });
    }
    Update the RGB colorizer on an image service layer
    {
      await QueuedTask.Run(() =>
      {
      // Get the colorizer from the image service layer.
      CIMRasterColorizer rColorizer = imageServiceLayer.GetColorizer();
      // Check if the colorizer is an RGB colorizer.
      if (rColorizer is CIMRasterRGBColorizer rasterRGBColorizer)
      {
        // Update RGB colorizer properties.
        rasterRGBColorizer.StretchType = RasterStretchType.ESRI;
        // Update the image service layer with the changed colorizer.
        imageServiceLayer.SetColorizer((CIMRasterColorizer)rasterRGBColorizer);
      }
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also