Nodes/comfyui-panels/Translate Polygon
ComfyUI Node

Translate Polygon

Nudge a Comic Panel Without Rebuilding the Page

By bmad4ever·Created 12 months ago·Updated 2 months ago· 41
Translate Polygon
  • polygon
  • POLYGON
xoff0.00
yoff0.00

bmad_TranslatePolygon moves a polygon by a horizontal and vertical offset, in pixels. That's the whole job - and it's the node you reach for when Build Layout Panels gave you panels in roughly the right place but not the right place. Comic pages are fussy: a panel that should bleed past the page edge, a character who should overlap into the neighboring panel, a gutter that's 4px too tight. This is the fine-tuning tool for all of it.

Why "polygon" and not "panel"

The pack deliberately calls its panels polygons in the node names and outputs, and the README says so: the polygon nomenclature is for compatibility with other packages that also work with shapely.Polygon objects. So this node isn't exclusive to the pack's comic-panel pipeline - if another custom node hands you a shapely polygon, Translate Polygon will happily move that too.

How it works

Under the hood it's a single call to shapely.affinity.translate with your offsets. No math to wrap your head around: add xoff to every x coordinate, add yoff to every y coordinate, hand back the moved polygon. The pack's coordinate space is image-style (origin top-left, y growing downward), so positive xoff moves a panel right and positive yoff moves it down the page. That trips people up - in math class y goes up, in image coordinates it doesn't.

The inputs

  • polygon - the panel to move. Wire it from Build Layout Panels, Detect Panels In Image, or from another polygon-op node in the chain (Rotate, Scale, Skew, Bevel, Offset Polygon Bounds - they all speak the same POLYGON type and can be chained).
  • xoff / yoff - floats, default 0, range -4096 to 4096 pixels. Generous range; for a standard 2480×3508 canvas you'll almost never leave the default 0 by more than a few hundred.

Output is a single POLYGON - the same shape, shifted - which continues down the chain to Panel to Mask, Polygon To Resized Mask, or Draw Panels Edges for the next stage of page assembly.

The trap

It moves one panel at a time. If you want to shift the whole page's layout, you either translate every panel or, better, move the canvas polygon before building - Build Layout Panels cuts the canvas, so a translated canvas shifts everything in one shot. Also, offsets are absolute pixels in canvas space; if you rescaled your panels somewhere upstream, your offsets are relative to that scaled space, which is easy to forget when you're dialing in a 12px nudge.

Install

Same pack, standard drill. ComfyUI Manager → search comfyui-panels → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_panels
cd comfyui_panels
pip install -r requirements.txt

Restart ComfyUI. You'll find it under Bmad/Panels. Dependencies are shapely, matplotlib, and opencv-python - no model downloads, no VRAM impact, just geometry.

CategoryBmad/Panels

Inputs (3)

NameTypeDefaultDescription
polygonPOLYGON
xoffFLOAT0.00-4096–4096
yoffFLOAT0.00-4096–4096

Outputs (1)

NameTypeDescription
POLYGONPOLYGON