ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.CIM Namespace / RasterStretchType Enumeration
Example Example

In This Topic
    RasterStretchType Enumeration
    In This Topic
    Raster stretch types.
    Syntax
    Members
    MemberDescription
    Count Stretch by count.
    Custom Custom stretch.
    DefaultFromSource Default stretch from source.
    ESRI Esri's stretch.
    HistogramEqualize Stretch histogram equalization.
    HistogramSpecification Stretch by histogram specification.
    Logarithm Logarithmic stretch.
    MinimumMaximum Stretch by minimum and maximum.
    None No raster stretch.
    PercentMinimumMaximum Stretch by percent minimum and maximum.
    SquareRoot Square root stretch.
    StandardDeviations Stretch by standard deviation.
    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 = isLayer.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.
        isLayer.SetColorizer((CIMRasterColorizer)rasterRGBColorizer);
      }
    });
    Get/Set Raster and Imagery Options
    var ro = ApplicationOptions.RasterImageryOptions;
    
    QueuedTask.Run(() =>
    {
      var validCategories = ro.GetValidColorRampCategories();
      var validCategory = validCategories.FirstOrDefault();
    
      var colorRamps = ColorFactory.Instance.GetColorRampNames(validCategory);
      var newColorRampName = colorRamps.FirstOrDefault();
    
      var stretchedColorRamp = ro.GetStretchedColorRamp();
      var colorRampName = ro.GetStretchedColorRampName();
      ro.SetStretchedColorRampName(null);
    
      var classifyColorRamp = ro.GetClassifyColorRamp();
      colorRampName = ro.GetClassifyColorRampName();
      ro.SetClassifyColorRampName(newColorRampName);
    
      var discreteColorRamp = ro.GetDiscreteColorRamp();
      colorRampName = ro.GetDiscreteColorRampName();
      ro.SetDiscreteColorRampName(newColorRampName);
    
      var uniqueValueColorRamp = ro.GetUniqueValueColorRamp();
      colorRampName = ro.GetUniqueValueColorRampName();
      ro.SetUniqueValueColorRampName(newColorRampName);
    
      var customRendering = ro.GetEnableCustomRenderingDefaults();
      ro.SetEnableCustomRenderingDefaults(!customRendering);
    
      var sampleType = ro.GetResampleType();
      ro.SetResampleType(RasterResamplingType.CubicConvolution);
    
      var stretchType = ro.GetStretchType();
      ro.SetStretchType(RasterStretchType.PercentMinimumMaximum);
    
      var val = ro.GetNumberOfStandardDeviation();
      ro.SetNumberOfStandardDeviation(3);
    
      var (clipMin, clipMax) = ro.GetClipPercentage();
      ro.SetClipPercentage(12, 23);
    
      var red = ro.GetGammaStretchValueRed();
      var green = ro.GetGammaStretchValueGreen();
      var blue = ro.GetGammaStretchValueBlue();
    
      ro.SetGammaStretchValueRed(2);
      ro.SetGammaStretchValueGreen(20);
      ro.SetGammaStretchValueBlue(60);
    
      var displayBackground = ro.GetDisplayBackground();
      ro.SetDisplayBackground(!displayBackground);
    
      var (r, g, b) = ro.GetBackgroundValue();
      ro.SetBackgroundValue(4, 21, 61);
    
      var backColor = ro.GetBackgroundColor();
      ro.SetBackgroundColor(CIMColor.CreateRGBColor(255, 0, 0));
    
      var noData = ro.GetNoDataColor();
      ro.SetNoDataColor(CIMColor.CreateRGBColor(0, 255, 0));
    
    
      // cache
      var useCache = ro.GetUseImageServiceCache();
      ro.SetUseImageServiceCache(!useCache);
    
      //dataset
    
      var opt = ro.GetPyramidOption();
      ro.SetPyramidOption(ArcGIS.Desktop.Core.BuildPyramidOption.NeverBuild);
      var sample = ro.GetPyramidResampleMethod();
      ro.SetPyramidResampleMethod(PyramidResamplingMode.Bilinear);
      var compression = ro.GetPyramidCompressionMethod();
      ro.SetPyramidCompressionMethod(PyramidCompressionType.JPEG_YCbCr);
    
      var quality = ro.GetPyramidCompressionQuality();
      ro.SetPyramidCompressionQuality(32);
    
      var stats = ro.GetStatisticsOption();
      ro.SetStatisticsOption(CalculateStatisticOption.AlwaysCalculate);
      var x = ro.GetSkipFactorX();
      ro.SetSkipFactorX(3);
      var y = ro.GetSkipFactorY();
      ro.SetSkipFactorY(23);
    
      var useWorldFile = ro.GetUseWorldFile();
      ro.SetUseWorldFile(!useWorldFile);
    
      var createTiledTiff = ro.GetCreateTiledTiff();
      ro.SetCreateTiledTiff(!createTiledTiff);
    
      var maxUniqueValues = ro.GetMaximumUniqueValues();
      ro.SetMaximumUniqueValues(123456);
    
      var path = ro.GetProxyFileLocation();
      ro.SetProxyFileLocation("c:\\temp");
    
      var isExpanded = ro.GetIsMosaicLayerExpanded();
      ro.SetIsMosaicLayerExpanded(!isExpanded);
      var isVisible = ro.GetIsMosaicBoundaryVisible();
      ro.SetIsMosaicBoundaryVisible(!isVisible);
      isVisible = ro.GetIsMosaicFootprintVisible();
      ro.SetIsMosaicFootprintVisible(!isVisible);
      isVisible = ro.GetIsMosaicSeamlinesVisible();
      ro.SetIsMosaicSeamlinesVisible(!isVisible);
      isVisible = ro.GetIsMosaicPreviewVisible();
      ro.SetIsMosaicPreviewVisible(!isVisible);
    
      var (red_3band, green_3band, blue_3band) = ro.Get3BandColor();
      ro.Set3BandColor(2, 2, 2);
      var (ms_red, ms_green, ms_blue) = ro.GetMSColor();
      ro.SetMSColor(23, 24, 25);
    
      var enableCustomColorSchemes = ro.GetEnableCustomColorSchemes();
      ro.SetEnableCustomColorSchemes(!enableCustomColorSchemes);
    
      var useWavelengthInfo = ro.GetUseWavelengthInformation();
      ro.SetUseWavelengthInformation(!useWavelengthInfo);
    });
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             ArcGIS.Core.CIM.RasterStretchType

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also