plots a histogram of the pixel levels for each channel in image.


uses bin specification bspec.


plots the histogram of the pixel values in the given range.

Details and Options

  • An image histogram is a graphical representation of the color distribution in an image.
  • ImageHistogram works with arbitrary grayscale and multichannel 2D and 3D images.
  • For RGB images, ImageHistogram by default displays the channels using red, green, and blue.
  • Binning specification bspec can be any of the following:
  • nn equally spaced bins
    Automaticautomatic choice of binning
    Allreturn tally of all available pixel values
    "Byte"256 levels after converting data values to a "Byte" type
  • By default, for binary images two bins are used; otherwise, 128 bins are used.
  • The range can be of the following forms:
  • Automaticautomatic ranges depending on the color space
    Allinclude all values
    {All,max}include values below max
    {min,All}include values above min
    {min,max}include values between min and max
  • The following defaults are used for range depending on the image color space. The ranges are chosen to include the subspace of the "RGB" color space.
  • "Grayscale","RGB","CMYK","HSB"{0,1}
  • ImageHistogram accepts options of ListPlot, with the following additions and changes:
  • Appearance Automaticdetailed appearance of the histogram
    AspectRatio1/3ratio of height to width
    AxesFalsewhether to draw axes
    FillingAxishow to fill in stems for each point
    FrameTruewhether to include a frame
    FrameTicksNoneframe ticks
    InterpolationOrder 0the polynomial degree of curves used in joining data points
    Joined Truewhether to join bars
    Method "IncludeOutOfRange"method to use
    PlotRangePaddingNonehow much to pad the range of values
  • Possible settings for Appearance are:
  • "RGB"show RGB channel values and overlapping colors
    "Separated"make separate histograms for each channel
    "Stacked"stack values for each channel
    "Transparent"show channels overlapping, using transparency
  • Possible settings for Method include:
  • "IncludeOutOfRange"values below range in first bin and values above range in last bin
    "ExcludeOutOfRange"do not count out-of-range values


open allclose all

Basic Examples  (3)

Histogram of an RGB image:

Histogram of a grayscale image:

Histogram of a 3D volume:

Scope  (6)

Specify the number of levels:

Histogram of a grayscale image showing all distinct levels:

Use range specification All to plot the histogram from the minimum to maximum value in the image:

Histogram of a binary image:

Use a range specification that includes negative values for plotting the histogram:

Histogram of a CMYK image:

Options  (10)

Appearance  (2)

Use additive colors to represent overlapping regions of histograms of an RGB image:

Show separate histograms for each color channel:

Stack the color channels vertically:

For non-RGB images, default plotting colors are used for all appearances:

Transparent histogram of a Lab image:

Stacked histogram:

Separated histogram:

InterpolationOrder  (2)

By default, the histogram is plotted with interpolation of order :

Create a smooth histogram of an image:

Joined  (1)

Render histogram using a stem plot:

Use a disjoint histogram:

Method  (1)

Control how pixels outside of the histogram range are counted and displayed:

PlotRange  (1)

Use PlotRange->Automatic for automatically determining the plot range:

PlotRange->All includes the entire histogram:

Modify the plot range to better visualize the distribution of higher intensities:

PlotTheme  (3)

Use a theme minimum styling:

Add horizontal grid lines to the plot:

Use a theme with dark background in a high-contrast color scheme:

Applications  (1)

Use the image histograms to estimate a suitable threshold:

Select threshold value using visual inspection of histograms:

Binarize image using selected threshold:

Properties & Relations  (3)

Image histogram can also be computed using Histogram; however, it is slower:

Find the histogram distribution of an image:

ImageHistogram blends alpha channel with black:

Blend with black before computing the histogram:

Blend with white:

Drop the alpha channel:

Possible Issues  (1)

Histograms with varying bin widths cannot be displayed using the "Stacked" appearance:

Use a different appearance:

Interactive Examples  (1)

Interactive histogram of an RGB image:

Neat Examples  (1)

Histogram of an image that is made progressively darker:

Wolfram Research (2008), ImageHistogram, Wolfram Language function, (updated 2014).


Wolfram Research (2008), ImageHistogram, Wolfram Language function, (updated 2014).


Wolfram Language. 2008. "ImageHistogram." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014.


Wolfram Language. (2008). ImageHistogram. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2023_imagehistogram, author="Wolfram Research", title="{ImageHistogram}", year="2014", howpublished="\url{}", note=[Accessed: 30-March-2023 ]}


@online{reference.wolfram_2023_imagehistogram, organization={Wolfram Research}, title={ImageHistogram}, year={2014}, url={}, note=[Accessed: 30-March-2023 ]}