Nodes/comfyui_ManhwaCropping/Manhwa Stitch Save
ComfyUI Node

Manhwa Stitch Save

Preview the edit on the page, then save only when you click it

By Norian11·Created 7 months ago·Updated 3 months ago· 0
Manhwa Stitch Save
  • original_image
  • modified_square
  • image
  • saved_file
x0
y0
size512
filename_prefixManhwaCrop
stitch_and_save_trigger0

Manhwa Stitch Save is the second half of the comfyui_ManhwaCropping workflow: Manhwa Crop carves a square panel out of a tall webtoon page, you edit that square with whatever inpainting or image-editing model you like, and this node pastes the edited square back onto the original page - then saves it, but only when you actually ask.

The "only when you ask" part is the whole point. A normal SaveImage writes a file every time the workflow runs, which means a folder full of near-identical PNGs while you iterate on a single panel. This node breaks that habit: it previews first, saves on demand. For a manhwa-restoration loop - remove the speech bubble, redraw, check, repeat - that's exactly the behavior you want, and it's why this is the one you'd reach for over wiring up a plain save node.

How it works

The backend is a geometry paste: it takes your modified_square, snaps the size to a multiple of 16, clamps it to the actual patch dimensions, and blits it onto original_image at (x, y). Nothing clever, nothing probabilistic - pure pixel surgery, and fast enough that re-running the workflow is free.

The save-gating is the interesting bit. There's a stitch_and_save_trigger integer that the front-end hides and replaces with a Stitch and Save button. Clicking it bumps the counter and re-queues the prompt; the node only writes a file when that counter has changed since the last run. So the very first execution never saves - that's the "preview without saving" mode the README promises - and later runs save only when you've pressed the button. Clever and simple.

When it does save, it writes to your ComfyUI output folder as {filename_prefix}_{counter:05}_.png (default prefix "ManhwaCrop"), and - like the stock SaveImage - embeds the full workflow and prompt metadata in the PNG, so the file you produce is a project file you can drag back onto the canvas.

Inputs and outputs

  • original_image - the untouched page. Wire it from the crop node's original output.
  • modified_square - your edited panel, typically the output of your img2img/inpaint step.
  • x, y, size - the paste coordinates. Wire these straight from the crop node; hand-typing them is how stitch jobs go wrong.
  • filename_prefix - string, defaults to "ManhwaCrop". Set it per page and you get clean, sortable filenames.
  • stitch_and_save_trigger - the hidden counter behind the button. Leave it alone.

Outputs: image is the stitched page (preview it in a viewer or feed it to a final save), and saved_file is a STRING with the full path of the file that was just written - empty on preview-only runs, which is handy if you're scripting.

Installing it

Same pack, same install as its sibling - Manager search "Manhwa", or:

cd ComfyUI/custom_nodes
git clone https://github.com/Norian11/comfyui_ManhwaCropping

Restart, and both nodes appear. No dependencies beyond what ComfyUI already ships, no model files.

Where people get burned

  • The first run never saves. It's by design - click "Stitch and Save" once to see the file appear, then re-run to preview the next variant.
  • The button needs the front-end. If you're driving ComfyUI as a pure API, there's no button; you'd increment stitch_and_save_trigger yourself to trigger a save.
  • Stale geometry pastes crooked. If x/y/size don't come from the crop node that made the square, you'll paste at the wrong spot or with the wrong size. Keep the pair wired together and it just works.

Preview on, save on click. For panel-by-panel manhwa work it's the least annoying way to get a clean page out of the other end.

Categoryimage

Inputs (7)

NameTypeDefaultDescription
original_imageIMAGE
modified_squareIMAGE
xINT0-100000–100000
yINT0-100000–100000
sizeINT5121–100000
filename_prefixSTRINGManhwaCrop
stitch_and_save_triggerINT00–2147483647

Outputs (2)

NameTypeDescription
imageIMAGE
saved_fileSTRING