Nodes/PlagueKind-Nodes/Visual Crop + Resize (BBox)
ComfyUI Node

Visual Crop + Resize (BBox)

Crop it by eye, then get it latent-ready — one node does both

By PlagueKind·Created 4 months ago·Updated 2 days ago· 161
Visual Crop + Resize (BBox)
  • image
  • mask
  • image
  • mask
  • width
  • height
  • x
  • y
aspect_ratio
custom_ratio_w1
custom_ratio_h1
crop_x0.000
crop_y0.000
crop_w1.000
crop_h1.000
show_crop_valuesfalse
scale_mode
long_side_target1024
short_side_target768
width1024
height1024
multiplier1.00
megapixels1.00
upscale_method
post_crop
divisible_by32
maintain_aspecttrue

Visual Crop + Resize (BBox) is the crop you actually live in: draw a box on the node, and in the same step the node runs your selection through the pack's unified resize pipeline - five scaling modes, an aspect-ratio lock, a divisible-by constraint, and an optional post-scale center crop. It exists because the dumbest recurring ComfyUI failure is feeding a sampler dimensions it can't handle. SDXL and LTX-2.x want side lengths divisible by 32 (or 64); crop to an arbitrary region and you'll get a "latent size not divisible" error or silently garbage output. This node makes that impossible to trip over by accident.

It's one of four node groups in PlagueKind-Nodes, a small personal pack (Plague_Kind) that also ships the crop-only Visual Crop (BBox), a unified resize node, and an LTX LoRA stack loader. If you're in LTX workflows, the LoRA loader is probably why you installed the pack - this crop/resize node is the bit you end up using every single run.

How it works

First half is the visual crop: run once, drag a box on the generated preview, and the node stores your selection as normalized 0–1 coordinates so it survives source resolution changes. Second half is the resize, and this is where it gets smarter than the stock ComfyUI image scale node:

  • scale_mode picks how the cropped region is sized: Dimensions (W × H), Multiplier, Longer Side, Shorter Side, or Total Pixels (MP).
  • divisible_by (default 32) snaps the result to a multiple of that value - the README's whole complaint about other nodes is that they "only do one side," so you'd upscale to 1024 wide but get 1019 tall. This node snaps both, and maintain_aspect keeps the ratio intact while it does it. Set divisible_by to 1 to disable.
  • post_crop (disabled/center) applies a scale-to-cover then center-crop when the target ratio doesn't match the source - the same trick "cover" mode uses in CSS.
  • upscale_method - nearest-exact, bilinear, area, bicubic, or lanczos. Bilinear is a sane default for getting latent input sizes; bicubic/lanczos if you care about the visual result.

The same transform is applied to the optional mask with a bilinear interpolate, so image and mask stay pixel-aligned - the recurring mask-drift problem this pack is built to kill.

The inputs and outputs that matter

  • aspect_ratio - Free, the standard presets, or Custom (via custom_ratio_w/h).
  • crop_x/y/w/h - normalized box, set by dragging.
  • scale_mode plus width/height, multiplier, megapixels, long_side_target/short_side_target - whichever one matches the mode you chose.
  • Outputs: image, mask, and width/height/x/y - the final size plus the crop origin in source-pixel space for compositing back.

Install

ComfyUI Manager → search "PlagueKind-Nodes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/PlagueKind/ComfyUI-PlagueKind-Nodes.git

Restart ComfyUI. No dependencies beyond stock ComfyUI - no requirements.txt in the repo, nothing to download.

Gotchas

  • No image connected → it becomes a resolution selector. The source falls back to computing the target size and prints "Resized to: W × H" in the node's text output. Handy for text-to-video setups where you just want the right latent dims, but confusing if you expected a crop.
  • First run is just to summon the preview - you can't draw the box until the node has executed once with an image.
  • Watch divisible_by on video. The default 32 is right for LTX-2.x, but if your workflow wants 64 you'll get faster sampling from a more expensive-looking number. Don't crank it blindly.
CategoryPlagueKind/image

Inputs (21)

NameTypeDefaultDescription
aspect_ratioCOMBO10 options: Free, 1:1, 4:3, 3:4, 16:9, 9:16, +4
custom_ratio_wINT11–100
custom_ratio_hINT11–100
crop_xFLOAT0.0000–1
crop_yFLOAT0.0000–1
crop_wFLOAT1.0000.001–1
crop_hFLOAT1.0000.001–1
show_crop_valuesBOOLEANfalse
scale_modeCOMBO5 options: Dimensions (W × H), Multiplier, Longer Side, Shorter Side, Total Pixels (MP)
long_side_targetINT10241–16384
short_side_targetINT7681–16384
widthINT10241–16384
heightINT10241–16384
multiplierFLOAT1.00
megapixelsFLOAT1.00
upscale_methodCOMBO5 options: nearest-exact, bilinear, area, bicubic, lanczos
post_cropCOMBO2 options: disabled, center
divisible_byINT321–512
maintain_aspectBOOLEANtrue
imageoptIMAGE
maskoptMASK

Outputs (6)

NameTypeDescription
imageIMAGE
maskMASK
widthINT
heightINT
xINT
yINT