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

  • ImageHistogram yields a graphical image, represented as a Graphics object.
  • 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:
  • AppearanceAutomaticdetailed 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
    InterpolationOrder0the polynomial degree of curves used in joining data points
    JoinedTruewhether to join bars
    Method"IncludeOutOfRange"method to use
    PlotRangePaddingNonehow much to pad the range of values
    PlotTheme$PlotThemeoverall theme for the plot
  • 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 all close all

Basic Examples  (3)

Histogram of an RGB image:

Click for copyable input

Histogram of a grayscale image:

Click for copyable input

Histogram of a 3D volume:

Click for copyable input

Scope  (6)

Options  (12)

Applications  (1)

Properties & Relations  (3)

Possible Issues  (1)

Interactive Examples  (1)

Neat Examples  (1)

Introduced in 2008
Updated in 2014