ComfyUI Node

SaveImage_Puzzle

Save the piece, tell the jigsaw app it's ready

By taabata·Created 3 years ago·Updated 2 years ago· 259
SaveImage_Puzzle
  • images
    filename_prefixComfyUI

    SaveImage_Puzzle is a save node for one of the stranger ideas in this pack: outpainting by jigsaw. The pack ships a small Flask app in the puzzle/ folder that slices your image into an irregular jigsaw grid, and lets you work on the canvas piece-by-piece - you generate each missing piece and it slots back into the puzzle. This node is the ComfyUI side of that handshake: it saves your generated image to the output folder and writes a lastimage.json into the pack's puzzle/ directory with a "done": "y" flag so the puzzle app knows a fresh piece is ready to pick up.

    It's a niche tool for a niche workflow, but if you've ever wanted to outpaint an image a tile at a time - keeping resolution high instead of stretching one pass - the idea has real appeal. Jigsaw-style tiling is also a legit trick in the wider outpainting world for controlling where the model invents content.

    How it works

    Same skeleton as SaveImage_LCM: numbered filename from filename_prefix, PNG written to ComfyUI/output/ with workflow metadata, then a JSON side-effect. The difference is where and what it writes: .../LCM_Inpaint_Outpaint_Comfy/puzzle/lastimage.json gets {"lastimage": "<full path>", "done": "y"}. The done flag is the "I'm finished generating, come get it" signal the puzzle app waits for. The images are converted via 255. * tensor + astype(uint8) rather than saved straight from the tensor, which is the same thing for standard IMAGE inputs.

    It's an output node (RETURN_TYPES empty, is_output_node true).

    The inputs that matter

    • images - the IMAGE tensor(s) to save.
    • filename_prefix - default ComfyUI. Output at ComfyUI/output/<prefix>_<counter>_.png.

    No outputs.

    How to install it

    Part of the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/taabata/LCM_Inpaint-Outpaint_Comfy
    cd LCM_Inpaint-Outpaint_Comfy
    pip install -r requirements.txt
    

    Or ComfyUI Manager → "LCM_Inpaint_Outpaint_Comfy" → restart. Using the full puzzle loop additionally means running the puzzle.py Flask app from the puzzle/ folder - the README's main setup only covers the CanvasTool server, so the puzzle app is a bit more DIY.

    Common issues

    The done flag is the thing to know: the puzzle app keys off it, and this node only sets it after a successful save. If the JSON write fails - because the puzzle/ folder was cleaned out, or a permission issue - the app will sit there waiting even though your PNG is on disk. Check for done: "y" in the file before debugging the app side.

    Beyond that, this is a save node with very little to break. It doesn't talk to any server and reads no environment variables, which makes it more robust than SaveImage_Canvas and functionally identical to SaveImage_PuzzleV2 - the V2 exists as a near-duplicate, so if one stops working the other is your fallback.

    Categoryimage

    Inputs (2)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRINGComfyUI

    Outputs (0)

    No outputs