Skip to main content
This topic has been closed for replies.

3 replies

Pedro Cortez Marques
Legend
December 14, 2017
Legend
December 11, 2017

What do you want to get exactly and for what?

The histogram of the document displays the distribution of the luminosity of the pixels,

which corresponds to the formula (for sRGB) L = 0.299*R + 0.587*G + 0.114*B.

The RGB histogram that you see in the "Histogram" or "Levels/Curves" panel is the sum of the channel histograms,

that is, hstRGB = hstR + hstG + hstB .

If you want to get a histogram for Brightnes from HSB (== MAX(R,G.B)), you can use the HSL/HSB plugin to convert layer RGB->HSB and then take the histogram of channel[2].

michal-44680644
Participating Frequently
December 14, 2017

thanks.

But after converting layer by the HSB/HSL filter I have still only R,G,B channels and my script says the same:

OutputHistogram(app.activeDocument.channels[2].histogram,app.activeDocument.channels[2].name, fileOut);

First lines of the generated file are(X is the scaled value, but the channel name counts here):

Channel name:Blue

000 X 29

001 X 1

002 X 1

003 X 4

004  0

005 X 34

006 X 2

007 X 2

008 X 1

009 X 4

010 X 3

...

channels[3] doesnt exist and in Channels panel are: RGB, R, G, B

I cant find histogram of brightness

Legend
December 14, 2017

I did not understand anything, but I will clarify just in case )

After applying the RGB-> HSB filter

Hue is in channel R, respectively, the histogram of channel R is the histogram of Hue.

Saturation is in channel G, respectively, the histogram of channel G is the histogram of Saturation.

Brigthness is in channel B, respectively, the channel B histogram is the Brigthness histogram.

Inspiring
March 26, 2013

app.activeDocument.histogram is practical speaking the luminosity levels of the document. Are those values not close enough for what you need?

michal-44680644
Participating Frequently
December 11, 2017

app.activeDocument.histogram is the document's histogram which is a histogram of RGB channel

Refer to each channel to get its histogram, but I dont think it is a luminosity histogram

Pedro Cortez Marques
Legend
December 11, 2017

var hL = activeDocument.histogram; // this is the luminosity histogram

var hR = activeDocument.channels["Red"].histogram;

var hG = activeDocument.channels["Green"].histogram;

var hB = activeDocument.channels["Blue"].histogram;