Nodes/DIGIT Nodes/DIGIT Drag Crop
ComfyUI Node

DIGIT Drag Crop

Stop typing pixel offsets — drag a crop box right on the image

By thedepartmentofexternalservices·Created 7 months ago·Updated 2 months ago· 0
DIGIT Drag Crop
  • image
  • mask
  • IMAGE
  • MASK
  • CROP_JSON
◄drawing_versioninit►
◄crop_left0►
◄crop_right0►
◄crop_top0►
◄crop_bottom0►
◄crop_width512►
◄crop_height512►
◄last_width0►
◄last_height0►
◄dest_width0►
◄dest_height0►
◄fit_modenone►
◄round_tooff►

Cropping in ComfyUI is usually the least visual thing you can do: type four numbers into a crop node, run it, squint at the result, type four more numbers. DIGIT Drag Crop throws all that out - you drag a crop box directly on the node's image preview, with resize handles, aspect-ratio locking, and pixel snapping. What you see is what you get, in real time.

It's the node you reach for any time a workflow needs "a region of this image" - prepping a face for inpainting, isolating a subject for a reference-to-video model, cropping a plate before it goes into the Drift QC gate. Anywhere you'd otherwise be guessing coordinates, this is the honest way to do it.

How it works

You run the graph once to load the image into the preview - that's a hard requirement, since the node needs image data from upstream before it can draw anything. Then the interactive UI takes over: click-drag to create a crop region, drag inside to move it, pull the corner and edge handles to resize. You can lock an aspect ratio by entering something like 16:9, snap the crop to a pixel grid (2/4/8/16/32/64), and toggle an info overlay showing dimensions.

The inputs behind the scenes: crop_left/right/top/bottom and crop_width/height are the numeric state that the UI writes (and that you can still type directly), and dest_width/dest_height with fit_mode (none, crop, fit_h, fit_v) let you resize the output to a target. round_to snaps output dimensions to a multiple - 8 for most models, 64 for SDXL - which quietly saves you from feeding a non-multiple-of-8 crop into a latent. There's an optional mask input that gets cropped to match, keeping your mask aligned with the image.

Outputs: the cropped IMAGE, the cropped MASK (zero if none connected), and CROP_JSON - a JSON string with all coordinates and dimensions, which you feed into DIGIT Crop Info to get the numbers as separate outputs.

Installing it

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/thedepartmentofexternalservices/comfyui-digit.git
cd comfyui-digit
pip install -r requirements.txt

Or ComfyUI Manager → search comfyui-digit → install → restart. Fully local, no credentials.

Where people get confused

The one real gotcha is the "run once first" behavior - people drag on an empty preview, nothing happens, and assume it's broken. It isn't: the node has to receive the image before it can display it, so queue the graph, let it run, and the interactive overlay appears on the re-render. Everything else is the usual ComfyUI weirdness of widgets vs. inputs - the crop values are graph inputs, so changing them re-runs downstream nodes, which is exactly what you want when the crop drives an inpaint or a video model.

CategoryDIGIT

Inputs (15)

NameTypeDefaultDescription
drawing_versionSTRINGinit—
imageIMAGE—
crop_leftINT00–8192—
crop_rightINT00–8192—
crop_topINT00–8192—
crop_bottomINT00–8192—
crop_widthINT5121–8192—
crop_heightINT5121–8192—
last_widthINT0—
last_heightINT0—
maskoptMASK—
dest_widthoptINT00–8192Destination width. 0 = use crop size as-is.
dest_heightoptINT00–8192Destination height. 0 = use crop size as-is.
fit_modeoptCOMBOnonenone=no resize, crop=fill and crop, fit_h=match height, fit_v=match width
round_tooptCOMBOoffRound output dimensions to nearest multiple. 8 works for most models, 64 for SDXL.

Outputs (3)

NameTypeDescription
IMAGEIMAGE—
MASKMASK—
CROP_JSONSTRING—