ps_get_histogram
Analyze image histograms to detect clipped shadows/highlights, verify exposure shifts after adjustments, and compare RGB channel means for neutral-gray checks.
Instructions
Whole-image (or per-channel) histogram — the quantitative answer to questions get_preview can't reliably answer by eye. Returns 256 bin counts plus mean / stdev / median. Cheap (~50ms), read-only. Reach for this when: (a) clipping detection — bins 0 and 255 carry the count of crushed shadows / blown highlights; you can't see clipping reliably in a downsampled JPEG preview; (b) exposure verification after a levels/curves/exposure adjustment — confirm the histogram actually shifted; (c) "is this image neutral-gray?" — compare R / G / B channel means; (d) confirming a destructive op did anything (two identical histograms = no-op regardless of the tool's success message). Composite reads the visible flattened image (any color mode). Per-channel reads require the document have that channel.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel | No | Which channel to read. "composite" (default) is the visible flattened image; if the active layer is an adjustment/fill/shape layer the tool transparently switches to a pixel layer to read it. "red"/"green"/"blue" require an RGB doc; "gray" a grayscale doc. "luminosity" dispatches per doc mode — Lab uses the Lightness channel (exact), Grayscale uses Gray (exact), RGB synthesizes a Rec.709 weighted approximation from R+G+B (mean is exact; stdev/median are approximations). The result's `channel` field annotates which path landed when a fallback was used. | composite |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bins | No | ||
| mean | No | ||
| stdev | No | ||
| median | No | ||
| channel | No | ||
| context | No | ||
| bin_count | No | ||
| total_pixels | No |