Nodes/Vevor Mask Union/Generative · Analyze Prompt
ComfyUI Node

Generative · Analyze Prompt

The Prompt That Makes A VLM Give You Boxes, Not A Description

By rexqin·Created about a month ago·Updated 19 days ago· 0
Generative · Analyze Prompt
    • prompt
    ◄user_line识别这张图上所有可见文字块,只输出 JSON 数组。►

    Ask a vision model to "describe this image" and you get a paragraph. Ask it for every text block with pixel boxes, a container box, alignment, weight, size percentage and a font-family classification - and you get something a pipeline can actually work from. Generative · Analyze Prompt is the pre-written version of that second ask, exposed as a node so you don't have to keep a 4000-character Chinese prompt in a text file on your desktop.

    It has exactly one job: build the prompt string. It runs no model, holds no state, and needs no GPU. Wire its prompt output into the text input of your VLM node and the image into the same VLM, and you have the front half of a layout-analysis pass.

    What's actually in the prompt

    The pack ships this prompt as a data file, and it's a lot more thorough than most people's hand-written attempts. For every visible text block it asks for:

    • text - verbatim transcription, newlines preserved.
    • bbox - the text's own box as [x, y, w, h], normalised 0–1.
    • containerBbox - the coloured panel, card, banner or capsule behind the text, including padding. The prompt is emphatic that this field matters and that it should be given whenever there's a flat backdrop, null only when text sits on bare photo texture. It's needed because a longer translation is only allowed to grow into its panel, never into a neighbouring line.
    • align - and it explicitly warns against defaulting everything to left; card titles are usually centred and models get this wrong by habit.
    • bold, sizePct - weight and font size as a percentage of image height.
    • fontFamily - a closed enum covering geometric-sans, neo-grotesque-sans, humanist-sans, grotesque-sans, condensed-sans, rounded-sans, serif, slab-serif, script, display, mono. The enum comes with a decision procedure: read the lowercase a (single- or double-storey), then the capital C (round arc or flat vertical edge), and never guess.
    • glyphTraits - free-text shape descriptors for the display text, with the model forbidden from naming a font.

    The fontFamily and glyphTraits fields are the interesting part. Every other layout-analysis prompt in circulation stops at boxes and text. This one is trying to carry typographic identity across the whole pipeline, because the downstream image prompt has to tell a diffusion model not to re-draw a geometric sans as a neo-grotesque - which, per the pack's own image prompt, is "the most common failure of this task".

    Inputs and outputs

    • user_line - STRING, single line. Your instruction to the analysis pass. Default is 识别这张图上所有可见文字块,只输出 JSON 数组。 ("find every visible text block in this image, output only a JSON array"). This is the steering wheel: it's where you say "this is an appliance listing, ignore the model number badge" or "only the large display text".

    • prompt - STRING. The full assembled prompt.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/rexqin/comfyui-vevor-mask-union
    # restart ComfyUI
    

    Manager → Vevor Mask Union. No dependencies, no weights. It appears in node search as Generative · Analyze Prompt.

    Where people get burned

    The prompt body is Chinese, and it's long. Small local models handle it unevenly - a 3B quantised model asked to obey a fifteen-rule Chinese analysis spec will happily answer in three sentences. If your analysis output is mush, suspect the model before the prompt. And if you need English, user_line is a single-line field; for a full translation you'll want the pack's template nodes, not this one.

    Don't change the output contract in user_line. Everything downstream - the block parser, the space-budget maths, the image prompt row format - assumes text, bbox as [x, y, w, h] normalised, and optionally containerBbox. Change the shape and you get blocks with wrong widths and translations that ignore the room they actually have. Your extra instructions should be about what to look at, never about what to return.

    It's a prompt builder, so it can't check anything. No model ran, no JSON was parsed. If the final image comes out with a swapped typeface or a title in the wrong place, the failure was one of the three nodes after this one, not this one.

    Skip it entirely if you're not doing generative re-typesetting. If you're erasing OCR boxes and drawing translated text with a real font file (the deterministic path in this pack), you want OCR geometry, not a designer's report. The two routes are alternatives, and mixing them just gives you two inconsistent coordinate systems for the same image.

    Categoryvevor/generative

    Inputs (1)

    NameTypeDefaultDescription
    user_lineSTRING识别这张图上所有可见文字块,只输出 JSON 数组。—

    Outputs (1)

    NameTypeDescription
    promptSTRING—