KJNodes/textgenerated

Ming-Image Prompt Builder KJ(MingImagePromptBuilderKJ)

Ming-Image Prompt Builder KJ is a visual prompt builder for Ming-Image's structured JSON caption, which is made of two parts: canvas_settings and layers.

Ming Image Prompt Builder KJ

aspect_ratio
image
bboxes
prompt
preview
bboxes
width
height
width
1024
height
1024
ambient_lighting
STRING
image_style
STRING
import_json
STRING
elements_data
STRING
bg_brightness
25
import_mode
when empty
output_format
pretty
custom
STRING
KJNodes

Description

Ming-Image Prompt Builder KJ is a visual prompt builder for Ming-Image's structured JSON caption, which is made of two parts: canvas_settings and layers.

Drag on the canvas to draw layers, then select a layer to set its description, hierarchy_and_relation and color_specs. Layers are listed back to front: layer 01 is the bottom one (usually the full-canvas background) and the highest number is the topmost overlay. The node outputs the assembled caption as a JSON string.

Layer coordinates are normalized "cx, cy, w, h" values (box center and size, all in the 0 to 1 range). The width and height inputs set the canvas aspect, and aspect_ratio follows them unless it is set to custom. Importing an existing caption reshapes width/height to that caption's aspect_ratio, at roughly the same pixel count.

Inputs

Required

  • width (INT, default 1024, range 64 to 16384, step 16): Canvas width. It is also the pixel grid used by the px coordinate field in the editor panel, so it should be a multiple of 16.
  • height (INT, default 1024, range 64 to 16384, step 16): Canvas height. As with width, it doubles as the pixel grid for the px coordinate field and should be a multiple of 16.
  • aspect_ratio (DYNAMICCOMBO): Written to canvas_settings.aspect_ratio. The available modes are:
    • auto: derives the ratio from width/height, for example 16:9.
    • auto_with_size: same as auto but appends the pixel size, for example 16:9, 1360 × 768 px.
    • custom: uses the value verbatim.
  • ambient_lighting (STRING, default empty): Written to canvas_settings.ambient_lighting. Describes global lighting, mood and exposure.
  • image_style (STRING, default empty): Written to canvas_settings.image_style. Describes the medium, rendering style, camera/lens choice and typography treatment.
  • elements_data (STRING, default empty): The serialized layers produced by the editor. This is managed by the node UI; you normally do not edit it by hand.
  • bg_brightness (INT, default 25, range 0 to 100): Background image brightness in percent. Managed by the brightness slider in the editor toolbar.
  • import_mode (COMBO, default when empty): Controls how a wired import_json is used.
    • when empty: only seeds the editor while it has no layers. After that the editor wins, so you can freely edit.
    • always: the wired JSON is authoritative, so its changes always propagate to the output.
  • output_format (STRING, default pretty): JSON formatting of the returned caption string. Set from the editor toolbar: pretty (indented, matching Ming-Image's example prompts) or compact (single line).
  • custom (STRING, default empty): Free-form field passed through by the node.

Optional

  • image (IMAGE): Optional reference image shown as the editor background (and behind the preview).
  • import_json (STRING, default empty): A full caption JSON. When connected, it loads into the editor and drives the output according to import_mode.
  • bboxes (BOUNDINGBOX): Optional pixel-space boxes ({x, y, width, height}) used to seed the editor's layers when it has none. Ignored once layers exist.

Outputs

The node returns five outputs, in this order:

  1. STRING: the assembled caption JSON string, formatted according to output_format.
  2. IMAGE: the image associated with the editor canvas, for example the reference image used as the background.
  3. BOUNDINGBOX: the boxes for the layers drawn in the editor.
  4. INT: a canvas dimension in pixels.
  5. INT: a canvas dimension in pixels.

Usage Notes

Canvas controls

  • Drag: draw a new layer. This also works inside a canvas-filling layer such as the background.
  • Ctrl/Cmd-drag: force-draw a new layer even on top of an existing one.
  • Click: select a layer. Alt-click: cycle through overlapping layers.
  • Double-click: edit the layer description inline.
  • Right-click: open the layer list, where the top entry is the frontmost layer. From there you can select, delete, duplicate, lock, or drag entries to reorder them.
  • Del / Backspace: remove the selected layer.
  • Ctrl/Cmd + C / V / D: copy, paste or duplicate the selected layer.
  • The coordinate fields in the panel (px / out) are editable.

Color swatches

  • Click: edit a swatch. Drag: reorder it. Right-click: remove it.
  • Hover + Ctrl/Cmd + C / V: copy or paste the hex value under the cursor.
  • "+": add a color. If the clipboard holds a color, that color is used.

Toolbar

  • Live: use the live sampling preview as the background, and grab the final result.
  • Grab BG / Clear BG: use the last generated image as the background, or remove it.
  • The toolbar also holds the brightness slider, a token estimate for the current caption, and the Copy / Paste / Clear all actions.

Import behavior

When import_json is connected, use import_mode to decide whether the imported caption merely seeds an empty editor (when empty) or stays in charge of the output (always). Importing a caption also reshapes width/height to match its aspect_ratio at approximately the same pixel count, so the canvas keeps its scale while adopting the imported proportions.

Comments

Sign in with GitHub to join the discussion.

Loading comments…