Nodes/comfyui-manga-panel/Manga Panel Selector
ComfyUI Node

Manga Panel Selector

Manga Panel Selector

By Tsubasa109·Created 2 months ago·Updated about a month ago· 9
Manga Panel Selector
  • image
  • page_image
  • panel_image
  • panel_mask
  • x
  • y
  • width
  • height
  • aspect_ratio
x0
y0
width512
height512

Manga pages are grids of rectangular panels, and if you want to regenerate one of those panels with Stable Diffusion you've got a boring, error-prone problem: type in the right x, y, width and height by hand, and if you're off by a pixel your generated panel won't line up when you paste it back. That's the problem this node kills. Manga Panel Selector puts a canvas right inside the node where you drag a red rectangle over the page, and it hands the rest of the workflow the coordinates, the cropped panel, and a ready-made mask. No coordinate arithmetic, no third-party editor.

It's the opening move of the whole pack's trick. Instead of generating an entire manga page at once - where a tiny action panel gets a few hundred pixels of model budget - you select one panel, render it big, and stitch it back later. That's the crop-and-stitch pattern the inpainting community converged on (think Inpaint Crop and Stitch), applied to comics specifically: the model spends its full resolution on the panel you actually care about, and the rest of the page never gets touched.

How it works

The node is two halves talking to each other. There's a JavaScript extension that adds a canvas widget to the node in the UI, and a Python backend that does the actual cropping.

The JS half does the fun part. If you connect the node straight to a standard Load Image, it loads that file before you even run anything - just drag the rectangle, and your selection is live. Drag on empty space to create a box, drag inside it to move it, grab a white corner handle to resize, and use the Full Image / Clear Selection buttons in the toolbar. Every drag writes back into the node's x, y, width and height widgets, which is how the coordinates survive the trip to Python.

If your image comes from anywhere other than Load Image (a VAE decode, a compositor, whatever), there's nothing to preview yet. Queue once, and the node renders the page via ComfyUI's built-in preview, and you can pick a panel from the result.

The Python side takes the image and that selection, clamps the box to the page bounds, crops the panel, and builds a page-sized mask that's 1.0 inside the panel and 0 everywhere else. That mask is the key output - it's exactly what the composite node needs later.

Inputs and outputs that matter

The image input is the page. The x, y, width, height widgets are the selection, but you almost never type in them - that's what the dragging is for.

The outputs are the payout:

  • page_image - the page, passed through unchanged.
  • panel_image - the cropped panel, handy if you want to run img2img straight from the crop.
  • panel_mask - the page-sized mask; wire this into the composite node.
  • x, y, width, height - the clamped coordinates, wired to both Manga Panel Resolution and Manga Panel Composite.
  • aspect_ratio - width over height, the number the Resolution node's math is built around.

Installing it

Install once for the whole pack; all three nodes ship together.

cd ComfyUI/custom_nodes
git clone https://github.com/Tsubasa109/comfyui_manga_panel.git

Then restart ComfyUI (or hit reload). You can also use ComfyUI Manager and search for comfyui-manga-panel. That's the entire install - the pack has zero Python dependencies beyond PyTorch, no model downloads, no API keys. Everything runs locally.

Gotchas

  • One page at a time. The node rejects batches; if you feed it a multi-frame image it errors out. Batch of 1, always.
  • No instant preview unless it's a real Load Image. Any other upstream node means "queue once to see it." The status bar will literally tell you.
  • Tiny selections get wiped. Drag anything under 4px and the UI resets it to nothing rather than passing junk to the crop.
  • Re-check after changing the page. The selection coords persist, so if you swap in a different page, your old box may sit somewhere meaningless. Hit Clear Selection and start fresh.

If you're new to the manga pipeline: Selector → Resolution → latent → KSampler → Composite is the whole game. The Selector is the friendly half; the Composite is the one that makes the output actually look like a page again.

Categoryimage/manga

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
xINT00–16384
yINT00–16384
widthINT5120–16384
heightINT5120–16384

Outputs (8)

NameTypeDescription
page_imageIMAGE
panel_imageIMAGE
panel_maskMASK
xINT
yINT
widthINT
heightINT
aspect_ratioFLOAT