Histogram is a image diagnostic rather than an image effect. When you apply the Histogram effect color levels are calculated and returned via the settings. The image is unaffected.

Image histograms show how color levels are distributed within an image. Each color channel has a value between 0 and 255 and the histogram simply returns the number of pixels with each of these values. A light image will have many values at the higher end of the histogram while a dark one will have many values at the lower end.



static Dictionary<ColorChannel,double[]> Histogram(Bitmap bitmap);

[Visual Basic]

Shared Function Histogram(bitmap As Bitmap) As Dictionary(Of ColorChannel,Double())
Name Description
bitmap The bitmap to process
return A dictionary mapping color channels to the intensities found in the image.



[C#]using (Bitmap bm = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/josh-hild-_TuI8tZHlk4-unsplash.jpg"))) {
  Dictionary<ColorChannel, double[]> hist = Effects.Histogram(bm);
  double aspectRatio = bm.Width / (double)bm.Height;
  int height = (int)Math.Round(600 / aspectRatio);
  using (Image small = bm.GetThumbnailImage(600, height)) {
    using (Graphics gr = Graphics.FromImage(small)) {
      DrawGraph(gr, small.Size, Color.Red, hist[ColorChannel.Red]);
      DrawGraph(gr, small.Size, Color.Green, hist[ColorChannel.Green]);
      DrawGraph(gr, small.Size, Color.Blue, hist[ColorChannel.Blue]);
void DrawGraph(Graphics gr, SizeF size, Color color, double[] values) {
  double max = 0;
  for (int i = 0; i < values.Length; i++)
    max = Math.Max(max, values[i]);
  PointF[] points = new PointF[values.Length];
  for (int i = 0; i < values.Length; i++) {
    double x = i * (size.Width / values.Length);
    double y = values[i] * (size.Height / max);
    points[i] = new PointF(x, y);
  gr.DrawLines(new Pen(new SolidBrush(color), 5), points);

Here we determine the color histogram for an image. Using the values we then draw a graph of the color levels on the image. Ouput files are shown below.