MOSS-Image bboxes template: `character_boxes` value has no effect · Issue #17174 · Comfy-Org/ComfyUI · GitHub
Skip to content

MOSS-Image bboxes template: character_boxes value has no effect #17174

Open

Description

@whipcrack-mp3

The shipped template image_moss_image_t2i_bboxes.json sets MOSSImageLayoutPrompt's
character_boxes to "1", but box 1 is a text box, so no element is ever labelled
character. The knight — the template's only obj box — is box 2 and comes out as
object. The template demonstrates the feature with a value that does nothing.

Repro

from comfy_extras.nodes_bounding_boxes import boxes_to_regions, build_elements
# editor_state / width / height taken from the shipped template
els = build_elements(boxes_to_regions(editor_state, 1024, 1024))
# element types: ['text', 'obj', 'text', 'text', 'text', 'text']

MOSSImageLayoutPrompt.execute(prompt="x", element=els, width=1024, height=1024,
                              character_boxes=cb)
character_boxes resulting labels
"1" (as shipped) ['text', 'object', 'text', 'text', 'text', 'text']
"" ['text', 'object', 'text', 'text', 'text', 'text']
"2" ['text', 'character', 'text', 'text', 'text', 'text']

"1" is indistinguishable from leaving the field empty.

Cause

comfy_extras/nodes_moss_image.py indexes across all elements:

for i, el in enumerate(element if isinstance(element, list) else []):
    label = "text" if el.get("type") == "text" else ("character" if i + 1 in characters else "object")

That is consistent with the Create Bounding Boxes preview, which tags every box
1-based regardless of type (nodes_bounding_boxes.py: tag = str(i + 1).zfill(2)).

The input's tooltip, though, reads:

Numbers of the object boxes to label as characters instead of objects, as tagged in
the Create Bounding Boxes preview

"Numbers of the object boxes" invites counting among object boxes only — under which
the knight is #1, exactly the value the template uses. The second clause is the
correct one, but the first is what the template appears to have followed.

Suggested fix

  1. Set character_boxes to "2" in image_moss_image_t2i_bboxes.json (and check
    image_moss_image_base_t2i_bboxes.json, which shares the layout).
  2. Optionally reword the tooltip to make the indexing unambiguous, e.g. "Numbers of
    the boxes to label as characters instead of objects, as tagged in the Create
    Bounding Boxes preview (counting all boxes, not just object boxes)."

Only the template value affects output; the tooltip change is cosmetic.

Environment

  • ComfyUI 446ef4e005fc7134d53ce6869ebd77d2134cd39c (v0.41.0)
  • comfyui-workflow-templates 0.11.89 / comfyui-workflow-templates-json 0.1.115
  • macOS, Apple M1 Max, torch 2.11.0, MPS

Activity

  1. added a commit that references this issue on Oct 19, 2026
    e2e3ba1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions