Nodes/ComfyUI-PhotoCraft Bridge/Photocraft ▸ Get Image
ComfyUI Node

Photocraft ▸ Get Image

Your canvas and your lasso, straight into the graph

By the-aSak·Created 21 days ago·Updated 7 days ago· 13
Photocraft ▸ Get Image
    • image
    • mask
    • width
    • height
    • target
    • prompt
    ◄crop_to_selectionfalse►
    ◄padding32►
    ◄multiple_of16►
    ◄sourcecomposite►
    ◄triggerqueue►
    ◄invert_maskfalse►

    The loudest inpainting complaint in 2026 isn't about model quality - it's about masking. Photoshop's Generative Fill wins on interface and loses on prompt control; Krita's plugin and Forge's masking UI are two ways people route around that.

    Photocraft ▸ Get Image is a third route. It's the input half of a two-node bridge between ComfyUI and PhotoCraft, the open-source Photoshop reimplementation in Rust - a real editor with lasso, magic wand, Quick Mask, layers and notes driving a ComfyUI graph. You select, type a prompt into a note on the canvas, hit Queue, and the graph runs on exactly that region. No export, no re-upload, no painting masks in a preview widget.

    How it actually works

    There's no PhotoCraft plugin doing this - its plugin API is sandboxed WebAssembly with no network or file access, so it can't talk to ComfyUI. The bridge uses PhotoCraft's own control channel instead: JSON command lines over 127.0.0.1 with a token file, and pixels as PNGs in a shared exchange folder (~/photocraft-bridge).

    Get never touches your document. It duplicates the flattened composite into a temporary document, exports it, and closes it; a selection gets the same treatment. Two consequences matter. The node's IS_CHANGED always reports "changed," so ComfyUI re-reads PhotoCraft on every queue - no stale cache, but no free re-runs either. And everything travels as 8-bit PNG: a 16-bit document comes back 8-bit, and colours outside sRGB clip where you edited.

    The inputs that matter

    Two are required. crop_to_selection (off by default) changes how you work: switch it on and the node hands out only the selection's bounding box plus padding pixels of context (default 32, step 8). That's the Generative Fill shape, and it's what lets a 12MP photo run through a 4B edit model. Raise padding when the model needs to see more around the edit.

    The optional ones: multiple_of (16) rounds the crop up so VAE Encode and Flux-type models don't quietly shift your result; source picks composite or active layer; invert_mask flips what gets changed (see the Quick Mask trap below); and trigger is queue or note change.

    Six outputs:

    • image - the crop (or whole canvas). Goes to VAE Encode or straight into an edit model.
    • mask - the selection, as a MASK. Wire it into masked conditioning; it also rides along inside target.
    • width / height - the size of the image it just handed you, already rounded to multiple_of. Feed these to your Empty Latent node instead of typing numbers.
    • target - the bookkeeping blob. Connect it to Send. It remembers the document, its layer ids, and where the crop came from.
    • prompt - the text of the document's Notes, joined line by line. Wire it into your text encoder's input; the prompt lives on the canvas, next to the pixels it describes.

    Install

    ComfyUI Manager, search "PhotoCraft Bridge" - or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/the-aSak/ComfyUI-Photocraft-Bridge.git
    

    Restart ComfyUI. On first start it creates the exchange folder and prints the exact command for starting PhotoCraft. Then start the editor with the control channel and both automation roots pointed at that folder:

    photocraft --control 7878 \
      --control-token-file ~/photocraft-bridge/control.token \
      --automation-read-root ~/photocraft-bridge \
      --automation-write-root ~/photocraft-bridge
    

    There are no Python dependencies to install - pyproject.toml declares dependencies = [], there's no requirements.txt, and nothing gets downloaded. Your "models" are whatever you already run; the README's tested list is Flux.2 Klein 4B and 9B, Krea 2, and Qwen-Image-Edit. You can override the port and folder with a git-ignored config.json in the node folder, but restart ComfyUI afterwards.

    Where people get burned

    PhotoCraft started normally does nothing. It only opens the control socket when launched with --control and both automation roots. The node's error prints the exact command - read it.

    bridge_dir and the automation roots must be the same folder. Change one in config.json and not the other and you get PhotoCraft saved …, but not into ….

    trigger: note change needs Run (Instant), the arrow next to Run. Run (On Change) watches the workflow, not PhotoCraft, so it will sit there forever. Typing must rest two seconds before it fires, and typing mid-run cancels that run - newest prompt wins.

    Quick Mask paints red what is not selected, same as Photoshop. If you painted the area you want changed in red, either turn on invert_mask or right-click the Quick Mask channel and switch it to "Color Indicates: Selected Areas." And a layer mask is not a selection - Ctrl-click its thumbnail to load it as one first.

    crop_to_selection with an empty selection throws The selection is empty (or lies outside the canvas).

    Finally, PhotoCraft calls itself early alpha and warns that command names may change. Update the editor and the bridge stops working? That's the first suspect.

    CategoryPhotocraft

    Inputs (6)

    NameTypeDefaultDescription
    crop_to_selectionBOOLEANfalse—
    paddingINT320–4096—
    multiple_ofoptINT161–128—
    sourceoptCOMBOcomposite2 options: composite, active layer
    triggeroptCOMBOqueue2 options: queue, note change
    invert_maskoptBOOLEANfalse—

    Outputs (6)

    NameTypeDescription
    imageIMAGE—
    maskMASK—
    widthINT—
    heightINT—
    targetPHOTOCRAFT_TARGET—
    promptSTRING—