Nodes/ComfyUI-BrainDead/BD Luma Stats
ComfyUI Node

BD Luma Stats

Measure luminance statistics of an image within an optional mask. Image passes through unchanged. Place inline in the grey-source pipeline to verify BD_NormalizeLuma + BD_CenterMedianLuma are hitting their targets: min_luma → should ≈ NormalizeLuma low_point max_luma → should ≈ NormalizeLuma high_point median → should ≈ CenterMedianLuma target_center recommended_outer_band = (max−min)/2 × 0.90 Paste this directly into u_float2 in BD_GLSLBatch.

By BizaNator·Created 7 months ago·Updated 16 days ago· 14
BD Luma Stats
  • image
  • mask
  • image
  • min_luma
  • max_luma
  • median_luma
  • mean_luma
  • recommended_outer_band
luma_standardbt709
Category🧠BrainDead/Segmentation

Inputs (3)

NameTypeDefaultDescription
imageIMAGESource image. Passed through to the image output unchanged.
luma_standardCOMBObt709RGB → luminance weighting: bt709 (default): 0.2126 R + 0.7152 G + 0.0722 B — modern sRGB/Rec.709 standard. Use for Unity/Unreal, AI pipelines, modern display work. bt601: 0.299 R + 0.587 G + 0.114 B — legacy NTSC weights, matches Photoshop 'Desaturate' and older tools. average: (R+G+B)/3 — simple, not perceptual.
maskoptMASKOptional region mask. When connected, stats are computed only from pixels where mask > 0.5. Strongly recommended: use your skin mask so background and clothing don't bias the measurements.

Outputs (6)

NameTypeDescription
imageIMAGEPass-through — image is unchanged.
min_lumaFLOATDarkest pixel luma in the masked region. Should ≈ BD_NormalizeLuma low_point (e.g. 0.10).
max_lumaFLOATBrightest pixel luma in the masked region. Should ≈ BD_NormalizeLuma high_point (e.g. 0.90).
median_lumaFLOATMedian luma. Should ≈ BD_CenterMedianLuma target_center (e.g. 0.50).
mean_lumaFLOATMean luma. Compare with median — large gap means a skewed distribution.
recommended_outer_bandFLOAT(max−min)/2 × 0.90. Paste into u_float2 in BD_GLSLBatch. The ×0.90 factor ensures the extreme ~10% of pixels exceed the outer band and reach V-curve alpha=1.0, giving the shader visible shadow/highlight depth.