Raster histogram stretching

Histogram contrast stretching allows you to customize a contrast stretch by interactively adjusting the histogram. Typically, ArcGIS AllSource displays the image and raster data with good contrast by default. When the preset contrast stretches do not produce the enhancement you want, histograms can be manually adjusted to change the contrast stretch of the raster.

The histogram of the contrast stretch shows you the distribution of the image pixels. The pixel values are along the x-axis, and the pixel counts are shown on the y-axis as a histogram. The histogram does not show every pixel's value due to binning of values.

Not all of the stretch types allow you to edit the histogram. The None and Esri stretch types only allow you to view the pixel distribution. The Minimum Maximum, Percent Clip, and Standard Deviation stretch types allow you to view the pixel distribution and interactively set the minimum and maximum input values so that the stretch focuses on the majority of the input values and disregards the outliers or tails of the distribution at either extreme. The Custom and Histogram Specification stretch types allow you to interactively create a piecewise histogram stretch to enhance specific portions of the histogram differently.

Stretch typeHistogram capability

  • None
  • Histogram Equalize
  • Esri

The histogram is read-only.

  • Minimum Maximum
  • Percent Clip
  • Standard Deviation

The minimum and maximum values of the histogram can be manually adjusted.

  • Histogram Specification

The histogram can be matched to an existing histogram file (.xml). Additionally, you can manually specify a piecewise histogram.

  • Custom

You can manually specify a piecewise histogram.

This allows you to create a custom stretch, where each portion of the histogram can be stretched differently.

View the histogram

You can view the raster histogram distribution when the RGB or Stretch symbology type is used in the Symbology pane. There are two methods to open the histogram view:

  • Click the Stretch Type button Stretch Type located on the Raster Layer, Mosaic Layer, or Image Service Layer tab.
    Note:

    If the stretch type is currently None and you click the Stretch button before you choose a different stretch type, you can only view the histogram. To adjust the histogram, change the Stretch type setting from the Symbology pane or use the arrow below the Stretch Type button, from the Raster Layer, Mosaic Layer, or Image Service Layer tab.

  • Click the Histogram button Raster Histogram Stretch in the Symbology pane.

The histogram displays the low and high breakpoint values along the histogram distribution where the histogram will be clipped. It also displays the histogram distribution for each rendered band in the image.

This histogram is viewable for all the stretch types; additionally, some of the stretch types allow you to edit the histogram. Below the histogram display is a Statistics section that shows the statistics of the data source. In the Information section, you can see input and output information for any location on the histogram by hovering the pointer over the histogram.

Edit the minimum and maximum values

When the stretch type is set to Minimum Maximum, Percent Clip, or Standard Deviation, you can view the histogram and also edit the minimum and maximum values of the histogram. When you set the high and low limits of the histogram, it adjusts the contrast stretch of the image. This helps to remove outlier values in high and low regions of the histogram.

To set the minimum and maximum histogram limits, click and hold the minimum or maximum triangle located below the dotted line, and move the breakpoint line along the x-axis to where you want to set the limit. You can use the graphical histogram display to determine where the limits should be set. If you know the minimum and maximum values you want to set, you can also double-click the minimum or maximum value, and type the number in the text box.

Once the histogram has been edited, the Histogram button Open edited histogram in the Symbology pane is updated to show that the histogram was updated.

Custom and Histogram Specification

When the stretch type is set to Histogram Specification, you can select a histogram file (.xml) to set the layer's histogram.

When the stretch type is set to Custom or Histogram Specification, you can interactively specify a piecewise histogram.

Click the Histogram button Open Histogram Page to open the Histogram page. For each rendered band, the histogram has a line that maps the input x-value and the stretched y-value. Initially this line is a straight diagonal from the lower left origin (minimum input, minimum output) to the upper right of the histogram graph (maximum input, maximum output). You place and adjust histogram stretch breakpoints along this line to create the piecewise histogram stretch.

You can use the following tools to edit the histogram, and you can manually add input and output:

  • Line tool Edit Histogram Line
  • Spline tool Edit Histogram Spline

The Line tool Edit Histogram Line is used to edit the piecewise line on the graph, which displays the stretched histogram superimposed over the original input histogram. This line sets how to map the output display values. Use the Line tool to create a set of vertices, where the input values map to the output display values. For instance, if you want the input value of 20 to be displayed as 30, place a point where the input (x) is 20 and the output (y) is 30. Once you complete the custom input and output values, click Apply to see the resulting stretch.

The Spline tool Edit Histogram Spline works similar to the Line tool, except the input-output line will be curved through the breakpoints.

Open the Manually add input and output category to see text boxes for x- and y-input. This functionality is similar to that of the Line tool, except instead of using the graphical display to set points, you type the input and output values in the text boxes and click the Add a point button Manually Add Input and Output to add another breakpoint to the histogram.

You can move any of the vertices to edit them; drag the vertex to the desired position on the histogram. To remove any of the vertices, hover over the vertex, click it, right-click, and choose Delete selected point. The Smooth button Smooth Histogram is used to smooth the curve rather than abrupt changes occurring pursuant to your breakpoint settings.

While you view the histogram, there are several tools you can use to query the data. The Information For Selected Area tool Information For Selected Area is used to highlight a portion of the histogram and the highlighted data is shown in the Information section. The Cumulative button Display Cumulative Histogram is used to change the display of the graph. Instead of showing the histogram distribution, two ascending curves are displayed, showing the input and output values for the input data and the stretched values. To return to the histogram view, click the Cumulative button again to turn off the cumulative view.

Once the histogram has been edited, the Histogram button Open edited histogram in the Symbology pane is updated to show that the histogram was updated.