Obtaining the histogram of an image with Python

To obtain the histogram of an image with Python using the PIL there is a specific function called histogram.

So, this code just create a grafic of that histogram.

Call it this way:

C:\python>python histogram.py inputfile.jpg output.jpg

The image could be .gif, .png, and other formats supported by the PIL

The code is here

Here is a histogram of this picture.

histogram

Posted on November 30, 2005 at 10:04 pm by Isaias · Permalink
In: Software

Leave a Reply