😺NKD Crop / Outpaint
Crop by dragging on the picture — and outpaint by shoving the box past the edge
- image
- fill_color
- image
- mask
- width
- height
- crop_data
Stop typing x, y, width, height into a transform node. 😺NKD Crop / Outpaint puts the crop box on the image - you drag a rectangle over the preview, rotate it with a knob, and whatever you framed is what comes out the other side. And it does one thing plain crop nodes won't: push that rectangle past the edge of the frame and it becomes an outpaint - the canvas grows and you get a mask over the new area so your sampler fills it in.
This is the manual half of the crop-and-stitch trick behind most serious ComfyUI editing: a small region gets a small latent budget, so a 60-pixel eye in a 1024 frame comes out a smear no matter how good the model is. Cut it out, run it at a resolution the model can actually resolve, paste it back. 😺NKD Crop is the "cut it out" step when you'd rather frame the region by eye than let a detector or mask decide for you.
Drawing the box
The node starts with no rectangle. Drag on empty space to draw one - that works whether or not one already exists, so redrawing never means deleting first. The area outside the box dims so you can read what you're about to throw away, and a 3×3 grid sits inside for composition. Drag inside the box to move it, drag the corner or edge handles to resize, and the little knob above the top edge rotates it (hold Shift to snap to 15°). A toolbar locks you to an aspect ratio - 1:1, 4:5, 3:4, 2:3, 9:16 and the landscape set.
The crop editor lives entirely in the node's frontend, so drawing and previewing costs no queue. The single input takes an image, a mask, or a video; video gets a play button and scrub bar under the preview, with the rectangle staying visible while it runs - how you find a framing that holds for a whole shot rather than just frame zero.
The inputs that matter
The region field exists but you'll never touch it - the tooltip says it plainly: managed by the crop editor on the node. The few you actually set:
mode-Cropkeeps the rectangle inside the source.Outpaintlets it extend past the edge and grow the canvas. That's the whole difference between the two.fill- what goes under the outpainted area before generation.edgereplicates the border pixel,reflectmirrors the image back out, or lay a flat tone (black,white,gray,colorviafill_color). Defaultedgeis the right call - the sampler works from real pixels instead of a void.divisible_by- snaps the rectangle itself to a multiple of 8/16/32/64 by growing it, not resampling. Models like MiniMax want their pixel grid; land off it and the model rescales behind your back. Leave itdisabledfor ordinary SD-style work.max_megapixels- resizes the result to that budget, and this one goes up as well as down. A small crop gets scaled up to reach the target, which is what makes "render this eye at full resolution" work.0disables.resize_methodpicks the filter when either of these actually resizes; masks always use bilinear regardless.
What comes out
Outputs are image, mask, width, height, and crop_data. With an image or video in, the mask is white only over the outpainted area - the polarity core nodes expect, so wire it into VAEEncodeForInpaint: white means "generate here." Feed the node a mask instead and it crops the mask itself, with image/crop_data coming back empty.
crop_data is the interesting one - a small object carrying the crop position, rotation angle and the original full-resolution frames, so the paired 😺NKD Crop / Outpaint Stitch drops your processed patch back exactly where it came from, angle and all. The original image only ever wires into this node; Stitch rebuilds the background from crop_data itself.
Install and gotchas
The pack is ComfyUI-NKD-Basic-Tools ("NKD Basic Tools" in Manager), from Nekodificador - a working VFX/retoucher who ships these as free tools. Install either way:
cd ComfyUI/custom_nodes
git clone https://github.com/Nekodificador/ComfyUI-NKD-Basic-Tools
then restart ComfyUI. No model downloads needed for these two - the crop math is pure torch. The pack is written against the newer node API, so if the nodes don't appear after install, update ComfyUI itself before hunting further.
Two traps worth knowing. First, max_megapixels upscales small crops too - set it on a crop that didn't need scaling and you've blurred it for no reason; 0 means "leave the size alone." Second, the fill in Outpaint mode is scaffolding for the sampler, nothing more. If an extension looks pasted-on, overlap the box more over the original edge so the seam lands on real detail instead of the fill.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE,MASK,VIDEO | — | |
| region | STRING | Managed by the crop editor on the node — no need to edit by hand. | |
| fill | COMBO | edge | How the outpainted area is filled before generation: edge replicates the border pixel, reflect mirrors it, or pick a flat colour. |
| fill_color | COLOR | #000000 | Colour used when fill = color. |
| max_megapixels | FLOAT | 0.000–128 | Resize the result to this many megapixels — up as well as down, so a small crop reaches the target too, not just a big one getting capped. 0 disables. |
| divisible_by | COMBO | disabled | Align the crop rectangle itself to a multiple of 8/16/32/64 (grown, not resized) — the pixel grid models like MiniMax need. Also snaps the final size after a megapixel resize. |
| mode | COMBO | Crop | Crop: the rectangle stays inside the source. Outpaint: it can extend past the edge to grow the canvas. |
| resize_method | COMBO | lanczos | Filter used when max_megapixels or divisible_by actually resizes the result. Masks always use bilinear regardless. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | The cropped/outpainted image (or video frames). None if the input was a mask. |
| mask | MASK | Input was image/video: white = outpainted area (generate here). Input was a mask: the cropped/outpainted mask itself. |
| width | INT | — |
| height | INT | — |
| crop_data | NKD_MANUAL_CROPDATA | Connect to 😺NKD Crop / Outpaint Stitch to composite the processed image back. None if the input was a mask. |