Nodes/Soda Storyboard/贴回格子 · Paste Panel
ComfyUI Node

贴回格子 · Paste Panel

Put the Redrawn Panel Back Without Seams or Double Lines

By cOkieeman·Created 3 days ago·Updated a day ago· 5
贴回格子 · Paste Panel
  • image
  • panel_image
  • IMAGE
◄panel_box►
◄protect_texttrue►

Repainting one panel of a finished page is the single most useful fix-up in a comic workflow: five panels are fine, one has a hand like a bag of cutlery, you crop it, upscale it, resample at a low denoise, and put it back. The last step is where every homegrown version of this breaks. You resize the patch by eye, it's a few pixels short, the slanted edge shows a staple of original art down one side, and the panel border doubles up.

SodaPastePanel is the last step done properly. It reads the geometry recorded when you cropped, resizes your patch to fit that exact box, and composites through the panel's real edge shape.

What it actually checks, and why that's good

The panel_box input isn't a box. It's the JSON blob SodaCropPanel emitted - box, original size, crop size, scale, page canvas size, panel id, and the page snapshot. This node parses it and then validates three things before touching a pixel.

The version field has to be 1. The size of the image you're pasting into has to equal the canvas size recorded at crop time. And the panel's box, re-derived from the page geometry at that canvas size, has to match the recorded box. Any mismatch raises with an explanation rather than producing a subtly misaligned page - "整页图尺寸与切格时不一致" if you've upscaled the page since cropping, "panel_box 与页面几何不一致" if the page geometry changed under it.

That's stricter than most ComfyUI nodes and it's the right call. Silently pasting into the wrong place is a bug you find three hours later.

The composite itself

Your patch gets resized to the original crop size with LANCZOS - so if you cropped at a 1024 long edge, upscaled to 2048, redrew, and pasted, the patch comes back down cleanly to the slot it belongs in. Then it's masked by the panel's quad shape, so a slanted panel gets a diagonal edge instead of a rectangle of new art sticking out into the gutter.

protect_text is on by default, and it does what it says: pixels belonging to the panel's existing lettering are preserved from the original rather than overwritten by the patch. Fix the art, keep the bubble. Turn it off when the dialogue itself is what you're replacing - otherwise the old text survives and SodaLetterPage draws the new line on top of it.

The final blend happens at tensor level, not just inside the PIL composite: pixels outside the editable area are taken from the original image tensor unchanged, so an unedited page keeps its exact float values with no round-trip quantisation. Inside the panel, the patch wins.

Inputs and output

image is the full page you're editing. panel_image is the redrawn panel. panel_box comes from the crop node, always. protect_text is the boolean above.

Batching is supported - multiple pages and multiple patches pair index by index - but the counts have to match, or one side has to be a single image which broadcasts to all. Anything else raises: "整页和重画格子的 batch 数必须相同,或其中一个为 1(广播)".

One output, IMAGE. Straight into lettering and saving, or into another paste if you fixed two panels.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/cOkieeman/ComfyUI-Soda-Storyboard
cd ComfyUI-Soda-Storyboard && python -m pip install --upgrade soda-storyboard

Manager → search Soda Storyboard (comfyui-soda-storyboard), restart. The core library is mandatory; Pillow rides along with it.

Where people get burned

The canvas-size check catches the most common mistake in this workflow: you crop from the page, upscale the panel for the redraw, and then paste into the upscaled page. That's fine - the check is against the page you paste into, so paste into the same page size you cropped from, then upscale the finished composite if you need a bigger export.

Version errors mean the panel_box didn't come from this node's sibling. If you're porting a workflow from an older Soda-MOSS setup, re-run the crop; old JSON text outputs aren't interchangeable with this string.

And don't chain the paste after a resize node that changes page dimensions between crop and paste. It's a hard error by design, but the fix is upstream: crop and paste in the same resolution space, do any upscaling either before the crop or after the paste.

CategorySoda Storyboard

Inputs (4)

NameTypeDefaultDescription
imageIMAGE—
panel_imageIMAGE—
panel_boxSTRING—
protect_textBOOLEANtrue—

Outputs (1)

NameTypeDescription
IMAGEIMAGE—