Nodes/ERPK Collection/Regional Prompt Builder
ComfyUI Node

Regional Prompt Builder

Draw regions on a canvas and emit a layout-aware prompt for image generation models, plus pixel bounding boxes.

By eRepublik-Labs·Created 10 months ago·Updated about a month ago· 0
Regional Prompt Builder
  • image
  • ref_1
  • ref_2
  • ref_3
  • ref_4
  • ref_5
  • ref_6
  • ref_7
  • ref_8
  • ref_9
  • ref_10
  • regions
  • prompt
  • bboxes
  • width
  • height
  • image
  • image_refs
  • masks
width1024
height1024
prompt
regions_data[]
removal_fillinpaint
chroma_color#00B140
desc_1
desc_2
desc_3
desc_4
desc_5
desc_6
desc_7
desc_8
desc_9
desc_10
CategoryERPK/utils

Inputs (28)

NameTypeDefaultDescription
widthINT102464–8192Target frame width in pixels
heightINT102464–8192Target frame height in pixels
promptSTRINGScene description: subject, setting, background, and style. Elements drawn on the canvas are placed on top of this scene.
regions_dataSTRING[]Managed by the canvas editor; JSON list of normalized regions.
removal_filloptCOMBOinpaintHow cleared areas (cut-outs and moved-region origins) are filled: 'inpaint' rebuilds the background (can smear on busy scenes); 'chroma' lays a flat key color to remove with a downstream chroma keyer.
chroma_coloroptSTRING#00B140Hex chroma key color used when removal_fill is 'chroma' (default chroma green; pick blue/magenta if the scene already contains the key color).
imageoptIMAGEOptional reference image shown under the canvas regions and passed through unchanged, so the builder can sit inline in an image-edit chain.
desc_1optSTRINGOverrides region 1's description when connected (regions numbered as on the canvas).
desc_2optSTRINGOverrides region 2's description when connected (regions numbered as on the canvas).
desc_3optSTRINGOverrides region 3's description when connected (regions numbered as on the canvas).
desc_4optSTRINGOverrides region 4's description when connected (regions numbered as on the canvas).
desc_5optSTRINGOverrides region 5's description when connected (regions numbered as on the canvas).
desc_6optSTRINGOverrides region 6's description when connected (regions numbered as on the canvas).
desc_7optSTRINGOverrides region 7's description when connected (regions numbered as on the canvas).
desc_8optSTRINGOverrides region 8's description when connected (regions numbered as on the canvas).
desc_9optSTRINGOverrides region 9's description when connected (regions numbered as on the canvas).
desc_10optSTRINGOverrides region 10's description when connected (regions numbered as on the canvas).
ref_1optIMAGEReference image for region 1. With an image connected and the region set to Node, it is composited into the scene at the region's box (background auto-keyed), pixel-exact; otherwise it is forwarded on image_refs and the region's prompt line cites its image number (regions numbered as on the canvas).
ref_2optIMAGEReference image for region 2. With an image connected and the region set to Node, it is composited into the scene at the region's box (background auto-keyed), pixel-exact; otherwise it is forwarded on image_refs and the region's prompt line cites its image number (regions numbered as on the canvas).
ref_3optIMAGEReference image for region 3. With an image connected and the region set to Node, it is composited into the scene at the region's box (background auto-keyed), pixel-exact; otherwise it is forwarded on image_refs and the region's prompt line cites its image number (regions numbered as on the canvas).
ref_4optIMAGEReference image for region 4. With an image connected and the region set to Node, it is composited into the scene at the region's box (background auto-keyed), pixel-exact; otherwise it is forwarded on image_refs and the region's prompt line cites its image number (regions numbered as on the canvas).
ref_5optIMAGEReference image for region 5. With an image connected and the region set to Node, it is composited into the scene at the region's box (background auto-keyed), pixel-exact; otherwise it is forwarded on image_refs and the region's prompt line cites its image number (regions numbered as on the canvas).
ref_6optIMAGEReference image for region 6. With an image connected and the region set to Node, it is composited into the scene at the region's box (background auto-keyed), pixel-exact; otherwise it is forwarded on image_refs and the region's prompt line cites its image number (regions numbered as on the canvas).
ref_7optIMAGEReference image for region 7. With an image connected and the region set to Node, it is composited into the scene at the region's box (background auto-keyed), pixel-exact; otherwise it is forwarded on image_refs and the region's prompt line cites its image number (regions numbered as on the canvas).
ref_8optIMAGEReference image for region 8. With an image connected and the region set to Node, it is composited into the scene at the region's box (background auto-keyed), pixel-exact; otherwise it is forwarded on image_refs and the region's prompt line cites its image number (regions numbered as on the canvas).
ref_9optIMAGEReference image for region 9. With an image connected and the region set to Node, it is composited into the scene at the region's box (background auto-keyed), pixel-exact; otherwise it is forwarded on image_refs and the region's prompt line cites its image number (regions numbered as on the canvas).
ref_10optIMAGEReference image for region 10. With an image connected and the region set to Node, it is composited into the scene at the region's box (background auto-keyed), pixel-exact; otherwise it is forwarded on image_refs and the region's prompt line cites its image number (regions numbered as on the canvas).
regionsoptERPK_REGIONSDetected regions (JSON) appended after the canvas regions at execute time. The canvas is unchanged, and desc_N/ref_N bind canvas regions only.

Outputs (7)

NameTypeDescription
promptSTRING
bboxesBOUNDING_BOX
widthINT
heightINT
imageIMAGE
image_refsERPK_IMAGE_REFSPer-region reference images in region order; connect to an image edit node's image_refs input.
masksMASKOne mask per region in region order [N, height, width]; regions without a stored segmentation get a filled-rectangle mask.