Python "it" Scripting
Histogram


return to main index

View Code:
    Histogram.py

Download:
    Histogram.py


Introduction

Histograms displayed by digital cameras and applications such as PhotoShop offer a convenient way of judging the distribution of brightness in an image. The python code presented in lising 1 adds a new item to the Commands menu of 'it', figure 1, that will display a histogram of the current catalog image in a Chrome browser.



Figure 1


The Histogram command saves, in a directory named "histogram" in the users home folder, a web page and two images. After saving the files the Histogram command opens the web page using Chrome. For example, the histogram of the rendered image shown in figure 1 can be viewed here,
    histogram.html.

A histogram of the same image displayed by the PhotoShop's,
    Image->Adjustments->Levels
menu is shown next. The histogram generated by the Histogram python code will, in general, closely match Photoshop's "Levels" of the same image.



Figure 2


Adding the Histogram Command to "it"

Information on how to add the Histogram command to "it" can be found in,
    "Python "it" Scripting: Adding to the Commands Menu"
An example of how the command is automatically loaded by "it" can be also found in,
    "RfM: Customizing"








© 2002- Malcolm Kesson. All rights reserved.