Tool to calculate the grayscale histogram of an image. An histogram is a graphical representation of the distribution of colours among the pixels of a numeric image.

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day! A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!

An image histogram is a type of statistical graph with ordered colors on x-axis and the number of pixels for each color on y-axis which allows to quickly assess the distribution of colors in an image.

In practice, the colors are usually limited to 100 or 255 levels of gray, the image is previously converted into grayscale.

How to compute an histogram?

With dCode, upload an image file (JPG, PNG, etc.) and click on Analyze.

Example:

How to compute a grayscale value?

Histogram is based on the frequency of luminance in the image. The luminance is computed for each pixel with the formula 0.2126*R+0.7152*G+0.0722*B (ITU BT.709).

How is organised an histogram?

The colors are organized according to their tone, blacks are on the left and on the right are whites, in the middle are gray tones.

How to display an Histogram in Matlab?

Use the imread function to load an image, then imhist to display its histogram.

Example:imhist(imread(image));

Source code

dCode retains ownership of the "Image Histogram" source code. Except explicit open source licence (indicated Creative Commons / free), the "Image Histogram" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or the "Image Histogram" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Image Histogram" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.

Cite dCode

The copy-paste of the page "Image Histogram" or any of its results, is allowed as long as you cite dCode!
Cite as source (bibliography): Image Histogram on dCode.fr [online website], retrieved on 2023-02-08, https://www.dcode.fr/image-histogram