Nodes/comfyui-fvmtools/K2 Project Import
ComfyUI Node

K2 Project Import

Bring a K2Lab project into your ComfyUI graph, boxes and all

By ping1979ping·Created 6 months ago·Updated about a month ago· 0
K2 Project Import
    • regions
    • loras
    • emphasis
    • tuning
    • projector
    • global_prompt
    • negative_prompt
    • width
    • height
    • info
    project_json{}
    width1024
    height1024
    strict_lora_namestrue

    K2 Project Import is the bridge between the standalone K2Lab desktop app (the Krea 2 bbox-prompting tool that kicked off this whole regional-control movement) and your ComfyUI graph. It takes a K2Lab / K2 Region Studio project JSON and turns it into normal K2 graph objects: regions, regional LoRAs, emphases, tuning, and projector. Paste a project you made in the standalone tool - or one a collaborator shared - and the whole layout arrives in ComfyUI ready to wire into K2 Compose.

    The inputs

    • project_json - the project JSON (multiline, default {}). It accepts the published schema (version 1) with regions, loras, emphases, spatial, and projector keys. Region boxes may be given as {x0,y0,x1,y1} or {x,y,width,height} - both handled.
    • width / height - the canvas the stored pixel boxes refer to. Set these to the canvas the project was designed on; the boxes are interpreted against it.
    • strict_lora_names - on (default): a LoRA file in the project that isn't installed raises an error. Off: it's skipped and listed in the info output. The default is the right default - a missing LoRA should be loud, not silent.

    The outputs

    regions, loras, emphasis, tuning, projector - the full K2 object set, which is exactly the set of optional inputs K2 Compose accepts. Plus global_prompt, negative_prompt, width, height, and an info string (which is where skipped LoRAs get listed when strict mode is off).

    What "project" means here

    Two uses worth knowing. First, round-tripping with the standalone app: you build a layout in K2Lab, export it, paste it here. Second, workflow portability inside ComfyUI: pair it with K2 Project Export, and you can save a layout to JSON, store it next to your outputs, and reproduce the exact layout in another workflow later. The import/export pair is the save-file system this suite doesn't otherwise have.

    Install

    Same as the whole pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ping1979ping/comfyui-FVMtools
    

    Restart ComfyUI, find it under FVM Tools/K2. No extra dependencies.

    The one gotcha is model inventory: the project references LoRAs by file name, and import matches them against your local models/loras by name. If a file is missing, strict mode tells you immediately - that's the feature working, not a bug. Get the file, re-run, and the layout lands complete.

    CategoryFVM Tools/K2

    Inputs (4)

    NameTypeDefaultDescription
    project_jsonSTRING{}K2Lab / K2 Region Studio project JSON.
    widthINT102464–16384Canvas the stored pixel boxes refer to.
    heightINT102464–16384Canvas height the stored boxes refer to.
    strict_lora_namesoptBOOLEANtrueOn: a LoRA file that is not installed raises an error. Off: it is skipped and listed in the info output.

    Outputs (10)

    NameTypeDescription
    regionsK2_REGION
    lorasK2_LORA
    emphasisK2_EMPHASIS
    tuningK2_TUNING
    projectorK2_PROJECTOR
    global_promptSTRING
    negative_promptSTRING
    widthINT
    heightINT
    infoSTRING