Beenden
  • Globale Community
    • Sprache:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

Getting Image Luminosity from Histogram?

Neu hier ,
Mar 25, 2013 Mar 25, 2013

Is there any clean, easy way to do this? I'm trying to create a conditional script that only applies certain effects if the image is above a certain luminosity level.

Thank you for any help!

THEMEN
Aktionen und Skripte
2.2K
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Adobe
Guru ,
Mar 25, 2013 Mar 25, 2013

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

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community-Einsteiger ,
Dec 10, 2017 Dec 10, 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

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Enthusiast ,
Dec 11, 2017 Dec 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;

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community-Einsteiger ,
Dec 11, 2017 Dec 11, 2017

Description from ps cc js ref-2015.pdf (histogram property of Document):

A histogram showing the number of pixels at each color intensity level for the composite channel. The array

contains 256 members. Valid only when mode=DocumentMode.RGB, CMYK or INDEXEDCOLOR

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Dec 11, 2017 Dec 11, 2017

https://forums.adobe.com/people/Pedro+Cortez+Marques  wrote

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;

Like Pedro wrote, I've always used the .histogram as Luminosity – for display purposes, mainly. Compared to the native Histogram palette, it seems like Photoshop is applying some sort of equalizing / thresholding in the display (e.g. mine left, PS right)

Davide Barranca - PS developer and author
www.ps-scripting.com
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Populärer Benutzer ,
Dec 11, 2017 Dec 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].

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community-Einsteiger ,
Dec 14, 2017 Dec 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

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Populärer Benutzer ,
Dec 14, 2017 Dec 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.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Enthusiast ,
Dec 14, 2017 Dec 14, 2017
AKTUELL
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines