Nodes/Region Edit Toolkit/图像分区 · 人脸编辑 Prompt 合约
ComfyUI Node

图像分区 · 人脸编辑 Prompt 合约

A prompt builder that writes the boring preservation paragraphs so you don't have to

By Liu-Bot24·Created 2 months ago·Updated about a month ago· 1
图像分区 · 人脸编辑 Prompt 合约
    • contract_prompt
    • structure_groups_json
    edit_instructionCreate a natural, coherent face with a clearly different overall identity while respecting all preservation constraints.
    change_eyestrue
    change_nosetrue
    change_mouthtrue
    change_jawfalse
    change_browsfalse
    prompt_modecontract
    identity_goaldifferent_from_source
    preserve_source_eye_interiorfalse
    preserve_source_face_lightingfalse

    There's a paragraph that every good face-edit prompt contains, and nobody enjoys writing it. It's the one that says "keep the head pose, the hair, the clothing, the background, the lighting - change only the face, and make it read as a clearly different person, not retouching." Miss it and your edit model drifts: the hairline shifts, the shirt recolors, the pose subtly rotates. RegionEditFacePromptContract is a text node that writes that paragraph for you, deterministically, based on a few toggles - it turns "a face edit prompt" into a contract about what may and may not change.

    It's the Text section of the Region Edit Toolkit, and it works hand-in-glove with the pack's mask discipline. The pack's premise is that you enforce what doesn't change with masks (protection regions, strict compositing) and with the prompt. The contract makes the prompt side reproducible - you get the same well-formed preservation language every run, instead of whatever you typed at 1 a.m.

    How it works

    You supply a short edit_instruction (the default is a sensible "create a natural, coherent face with a clearly different overall identity while respecting all preservation constraints") and a set of toggles: change_eyes, change_nose, change_mouth (all default true), change_jaw, change_brows (both default false). The node assembles a contract_prompt that starts from a strong preservation block - head pose, gaze direction, expression intent, hairstyle, ears, neck, clothing, composition, camera perspective, lighting direction, texture, grain - then adds per-toggle instructions for the features you allowed to change.

    The optional inputs add precision:

    • prompt_mode - contract (the full built-up prompt) or raw (just your instruction, no scaffolding). Useful for A/B testing whether the contract is actually doing anything.
    • identity_goal - different_from_source (the default) or match_reference_identity, which swaps in a block saying "be the same identity as the reference, don't average."
    • preserve_source_eye_interior - adds a paragraph protecting iris color, pupil, sclera, catchlights from the other input image. Pairs with the eye-restore nodes.
    • preserve_source_face_lighting - protects lighting direction, exposure, shadow shape from being "improved" into beauty lighting.

    The second output, structure_groups_json, is a machine-readable version of which feature groups are changeable - the pack uses it to keep the mask pipeline and the prompt in agreement.

    Install

    ComfyUI Manager → search "Region Edit Toolkit" (package ID native-region-tile-planner-merge) → install → restart. Or git clone https://github.com/Liu-Bot24/ComfyUI-Region-Edit-Toolkit.git into custom_nodes, pip install -r requirements.txt into ComfyUI's Python, restart. Python 3.10+, deps numpy/Pillow/scipy/argostranslate. No models - it's a string builder.

    Gotchas

    The default toggles assume a full identity change: eyes, nose, mouth all allowed to change. If you're doing a subtle fix (just the mouth), set the others to false or the contract will actively instruct the model to rewrite the nose. And the contract is opinionated - it hard-codes "don't paste original hair back across the generated region" and "no straight transition line across hair or skin," which is great for the pack's own crops but reads oddly if you're prompting for a different workflow. If the prose feels heavy, that's what prompt_mode: raw is for; test with both and keep what works.

    CategoryRegion Edit Toolkit/Text

    Inputs (10)

    NameTypeDefaultDescription
    edit_instructionSTRINGCreate a natural, coherent face with a clearly different overall identity while respecting all preservation constraints.
    change_eyesBOOLEANtrue
    change_noseBOOLEANtrue
    change_mouthBOOLEANtrue
    change_jawBOOLEANfalse
    change_browsBOOLEANfalse
    prompt_modeoptCOMBOcontract2 options: contract, raw
    identity_goaloptCOMBOdifferent_from_source2 options: different_from_source, match_reference_identity
    preserve_source_eye_interioroptBOOLEANfalse
    preserve_source_face_lightingoptBOOLEANfalse

    Outputs (2)

    NameTypeDescription
    contract_promptSTRING
    structure_groups_jsonSTRING