Visual Crop (BBox)
Draw your crop box right on the node — no more eyeballing pixel math
- image
- mask
- image
- mask
- width
- height
- x
- y
Cropping in plain ComfyUI means picking numbers. You want a 16:9 slice out of a 1216×832 image? Fire up a calculator or guess until it looks close. Visual Crop (BBox) replaces that whole ritual with a drag box drawn directly on the node: run once to get a preview, then click and drag to the region you want, with an aspect-ratio lock so the box stays honest. It's the "eyeball it" crop that you can actually see.
It's one of the two crop nodes in PlagueKind-Nodes, a small personal pack from Plague_Kind. The sibling, Visual Crop + Resize, chains the same crop into a resize pipeline; this one is crop-only, which makes it the right pick when you want the box and the numbers and nothing else.
How it works
Run it once with an image connected and the node saves the uncropped input as a temporary preview (in ComfyUI's temp folder) and hands it to a custom canvas widget in the pack's JS. You drag the box over the preview with corner handles; the widget writes your selection back as four normalized coordinates - crop_x, crop_y, crop_w, crop_h, all 0–1. On the next run the Python side converts those fractions to pixels, clamps them to the image bounds, and - if an aspect ratio is set - tightens the box to match that ratio before slicing.
Because the crop is stored as fractions rather than pixel offsets, the box holds its relative position if the source image's resolution changes. That's a genuinely nice property for workflows that get re-run on differently-sized inputs.
The same box is applied to the optional mask input, which is the pack's whole thesis: image and mask get identical geometric treatment, so you never end up with an inpaint mask that's drifted a few pixels off the thing it's masking.
The inputs and outputs that matter
aspect_ratio-Free, the common presets (1:1,4:3,16:9,21:9,3:2,2:3, and their portrait twins), orCustom, which usescustom_ratio_w/custom_ratio_h.crop_x,crop_y,crop_w,crop_h- the normalized box. You mostly set these by dragging; they're floats 0–1 with 0.001 steps.show_crop_values- a toggle that exposes the numeric box if you'd rather type coordinates than drag.image/mask(optional) - what gets cropped.- Outputs:
image,mask, pluswidth,height,x,y- the crop's pixel-space origin, which you need if you're compositing the result back onto the original later (classic crop-and-stitch for inpainting at full resolution).
Install
ComfyUI Manager → search "PlagueKind-Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/PlagueKind/ComfyUI-PlagueKind-Nodes.git
Restart ComfyUI. No extra dependencies - the pack's README lists nothing beyond stock ComfyUI, and there's no requirements.txt in the repo.
Gotchas
- It needs a run before you can draw. The preview only exists after the node executes once with an image connected, so your first pass is just to summon the canvas. The README says it plainly: "draw it on the node after a single run."
- No image connected → no crop. The source returns a 1×1 dummy image with 1×1 dims, so it won't crash, but it's a resolution placeholder, not output.
- The preview isn't a normal node preview. It uses a custom UI key so ComfyUI's default preview strip doesn't fight the canvas. If your preview isn't showing, check you're on a recent ComfyUI - the canvas widget needs the frontend to load the pack's JS.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| aspect_ratio | COMBO | 10 options: Free, 1:1, 4:3, 3:4, 16:9, 9:16, +4 | |
| custom_ratio_w | INT | 11–100 | — |
| custom_ratio_h | INT | 11–100 | — |
| crop_x | FLOAT | 0.0000–1 | — |
| crop_y | FLOAT | 0.0000–1 | — |
| crop_w | FLOAT | 1.0000.001–1 | — |
| crop_h | FLOAT | 1.0000.001–1 | — |
| show_crop_values | BOOLEAN | false | — |
| imageopt | IMAGE | — | |
| maskopt | MASK | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| width | INT | — |
| height | INT | — |
| x | INT | — |
| y | INT | — |