Nodes/lf-nodes/Masked Lab grade
ComfyUI Node

Masked Lab grade

Shift and scale a masked region's CIE Lab mean and spread to a reference region's, the spread change bounded. Matches a patch, a decal or a texture to the colour around it.

By lucafoscili·Created 2 years ago·Updated 5 days ago· 36
Masked Lab grade
  • image
  • mask
  • reference_image
  • reference_mask
  • ui_widget
  • image
  • report
  • image_list
◄min_stretch0.25►
◄max_stretch1.00►
◄amount1.00►
◄apply_tomask►
Category✨ LF Nodes/Texture

Inputs (9)

NameTypeDefaultDescription
imageIMAGEImage(s) to grade (sRGB).
maskMASKThe region to measure and grade; values weight both. One mask for all images or one per image.
reference_imageIMAGEImage holding the colour to match: one for all images or one per image.
reference_maskMASKThe reference region on reference_image; values weight the measurement.
min_stretchFLOAT0.250.01–4Lowest factor applied to each Lab channel's spread (reference spread / image spread, clamped).
max_stretchFLOAT1.000.01–4Highest spread factor. 1.0 may narrow the spread but never widens it, so noise is not amplified.
amountFLOAT1.000–1Share of the grade applied: 0 keeps the image, 1 matches the reference.
apply_toCOMBOmaskmask: blend the grade by the mask's values; image: grade every pixel by the masked measurement.
ui_widgetoptLF_COMPARE[object Object]—

Outputs (3)

NameTypeDescription
imageIMAGEGraded image batch; pixels with zero weight and alpha are unchanged.
reportJSONlf.masked-lab-grade.v1: Lab mean and spread of the image, reference and result regions, and the stretch.
image_listIMAGEThe same graded images as an authoritative list.