Nodes/ComfyUI-Apt_Preset/lay_text_sum_mul
ComfyUI Node

lay_text_sum_mul

Labeling multiple points on one image at once

By cardenluo·Created 2 years ago·Updated 18 days ago· 309
lay_text_sum_mul
  • image
  • GradientAndStroke
  • ShadowAndGlow
  • EmbossAndFill
  • image
original_coordinate[{"x":0.5,"y":0.5,"index":1}, {"x":0.6,"y":0.6,"index":2}, {"x":0.7,"y":0.7,"index":3}]
index_replace
font_fileQuakeLove-Regular.otf
font_size12
arrangementhorizontal
text_rotation0
text_color#ffffff
text_opacity1.00

lay_text_sum draws one piece of text at one spot. lay_text_sum_mul is what you reach for when you need several labels scattered across the same image in a single node - annotating multiple detected regions, numbering steps in a diagram, or labeling several points of interest without chaining a stack of single-text nodes together.

What it does

This is another node from cardenluo's ComfyUI-Apt_Preset, sitting in the same imgEffect family as lay_text_sum. Instead of fixed pixel x/y coordinates, it takes original_coordinate - a JSON array of {x, y, index} objects where x/y are normalized 0–1 fractions of the image (so they scale with image size instead of being tied to exact pixels) and index is a label ID. The default value shows the shape: [{"x":0.5,"y":0.5,"index":1}, {"x":0.6,"y":0.6,"index":2}, {"x":0.7,"y":0.7,"index":3}].

The actual text for each point comes from index_replace, a separate multiline string field - going by the pattern, you supply per-index text there (matching each index in original_coordinate to the string you want drawn at that point) rather than editing the coordinate JSON itself for text content. Once matched up, each label gets the same styling controls as the single-text node: font_file, font_size, arrangement (horizontal/vertical), text_rotation, text_color, text_opacity, plus the same optional GradientAndStroke / ShadowAndGlow / EmbossAndFill data inputs for advanced styling fed in from companion nodes elsewhere in the pack.

Inputs and outputs

Required: image, original_coordinate (JSON array of normalized point + index), index_replace (per-index label text), font_file, font_size, arrangement, text_rotation, text_color, text_opacity. Optional: GradientAndStroke, ShadowAndGlow, EmbossAndFill.

Single image output with all labels burned in at once.

The field that trips people up is original_coordinate - it's raw JSON, so a missing comma or bracket breaks the whole node. Start from the default value and edit it incrementally rather than writing it from scratch.

Where this fits

This node is built for cases where positions come from somewhere programmatic - a detector's bounding-box centers, a fixed set of annotation points you reuse across a batch of similar images, or numbered callouts on a diagram. If you're placing one caption by hand, lay_text_sum's plain pixel coordinates are simpler; reach for this one once you're placing more than two or three labels, or when the positions are relative to image size rather than fixed pixels.

Installing it

Through ComfyUI Manager: search ComfyUI-Apt_Preset. Manual install:

cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git

Run install.bat (Windows) or install requirements.txt yourself, then restart. Same bundled-font dependency as lay_text_sum - a full clone gets you the complete font list.

Troubleshooting

Start with the pack import: ComfyUI-Apt_Preset is large enough that a missing dependency can take the whole thing down on load, which is exactly what one Reddit user hit while chasing an unrelated issue - check your ComfyUI console at startup for the actual error if this node (or any Apt_Preset node) isn't showing up.

For this node specifically, malformed JSON in original_coordinate is the most likely first error - validate it in any JSON linter if ComfyUI throws a parse error rather than staring at the workflow graph looking for the bug. And if a label doesn't appear, double-check that its index in original_coordinate actually has a matching entry in index_replace; an index with no text mapped to it is the quiet way for a label to just not show up.

CategoryApt_Preset/imgEffect

Inputs (12)

NameTypeDefaultDescription
imageIMAGE
original_coordinateSTRING[{"x":0.5,"y":0.5,"index":1}, {"x":0.6,"y":0.6,"index":2}, {"x":0.7,"y":0.7,"index":3}]
index_replaceSTRING
font_fileCOMBOQuakeLove-Regular.otf8 options: QuakeLove-Regular.otf, Autography.otf, Romellast.otf, FlowPerfect.ttf, en-LOLItalic.ttf, Alibaba-PuHuiTi-Heavy.ttf, +2
font_sizeINT120–320
arrangementCOMBOhorizontal2 options: horizontal, vertical
text_rotationINT0-180–180
text_colorSTRING#ffffff
text_opacityFLOAT1.000–1
GradientAndStrokeoptGRADIENT_AND_STROKE_DATA
ShadowAndGlowoptSHADOW_AND_GLOW_DATA
EmbossAndFilloptEMBOSS_AND_FILL_DATA

Outputs (1)

NameTypeDescription
imageIMAGE