X2HDR Metrics
What's actually inside that float tensor
- hdr_image
- metrics_json
The whole problem with linear HDR in ComfyUI is that you can't look at it. A float tensor with values up to 4000 nits doesn't render on a normal monitor, and "it looks dark" tells you nothing about whether the decode actually worked. X2HDR Metrics is the tape measure: it computes luminance and RGB statistics for a linear HDR tensor and hands you a JSON report.
One input, one output. That's the whole node.
- hdr_image (
IMAGE) - your linear HDR tensor. - metrics_json (
STRING) - the report.
What you get back
- min_rgb / mean_rgb / max_rgb - your first "is this HDR" check.
max_rgbabove 1.0 means there's real float headroom; if it's pinned at 1.0, the decode didn't produce HDR range. - Luminance percentiles -
lum_p01throughlum_p995pluslum_maxandlum_mean. These use Rec.709 weights (0.2126 / 0.7152 / 0.0722), the standard brightness math. - Dynamic range in stops -
stops_p995_over_p01andstops_max_over_p01, the log2 ratio between highlight and shadow bands. - negative_values and nonfinite_values - diagnostic counts that tell you when a decode is behaving and when it's broken.
Mechanically it's straightforward per-frame torch/numpy statistics - nothing clever, which is the point. It's a diagnostic, not a feature.
Where it fits
Run it after X2HDR PU21 Decode, X2HDR LogC3 Decode, or X2HDR LogC4 Decode, before you spend time grading. If max_rgb sits at 1.0 or lum_p995 barely clears 1.0, you're chasing a pipeline problem, not a grade. It's the cheaper sibling of X2HDR Dynamic Range QA: Metrics reports raw numbers; QA turns the same kind of statistics into a pass/review verdict plus an exposure strip. When you just want the numbers, this is the node.
Installing it
Part of facok/comfyui-x2hdr. ComfyUI Manager → search comfyui-x2hdr → install, restart, nodes under image/HDR/X2HDR. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/facok/comfyui-x2hdr
then restart. The one extra dependency is PyAV (av), imported at load time; pip install av in ComfyUI's Python environment if the pack errors.
Where people get burned
- The output is a STRING, not a display. Wire
metrics_jsonto a text-display / Show Text node - it won't render by itself. - Read the negative and nonfinite counts, don't skim them. A large
negative_valuescount right after LogC decode is expected (code values below reference black). A largenonfinite_valuescount is a decode problem - NaNs and infs shouldn't survive a healthy pipeline. - It's deterministic and cheap, so you can leave it inline without slowing the graph down.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| hdr_image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| metrics_json | STRING | — |