Crop Latent
Reframe the canvas before the sampler spends a pass
- samples
- LATENT
Crop Latent takes a latent and cuts it down to a width, height, x, and y - in latent space, before you've ever decoded or resampled. Think of it as cropping the canvas, not the finished picture. You specify pixel coordinates, the node divides by the model's downscale factor (8 for most), and returns the cropped latent. It's the cheapest possible reframe: no VAE round-trip, no second decode.
The inputs are all you'd expect: samples, then width, height, x, y - all in pixels, all floored to 8-pixel cells (the latent grid). Output is a LATENT at the new size.
Where it actually earns its keep
Outpainting. This is the node's home turf. The classic workflow: generate an image, Crop Latent to keep just the top strip of the latent, drop it onto a bigger blank canvas (Latent Composite does the pasting), and run the sampler over the combined latent at full denoise to invent the rest. Because the crop happens in latent space, the seam between kept and generated content is a latent-boundary thing, not a pixel thing - cleaner to work with, and far cheaper than decoding and re-encoding.
Hi-res fix / detail passes. Crop a region you want to regenerate at higher fidelity, run a second sampling pass on just that latent, then composite it back. Same family of trick, one node earlier.
Reframing without regenerating. Cropped off a portrait's dead space before it ever touches a sampler - no wasted VRAM on pixels you were going to throw away.
The gotcha that bites everyone
The node crops samples but does not crop the noise mask. If you set a noise mask (Set Latent Noise Mask) and then crop the latent, the mask keeps its original full-size shape while the latent shrinks - the two stop lining up, and your next sampling pass treats the mask as if it's a different size than the latent, which either errors or quietly inpaints the wrong region. Rule of thumb: crop first, then mask. Same trap applies to any batch metadata that's shaped like the image.
Also note the coordinates are floored to 8-pixel cells. If you crop at x=13, you get x=8 - not a bug, just the latent grid asserting itself. For exact crops, work in multiples of 8. And if you crop and need to put the result back somewhere, remember the output latent knows nothing about where it came from - that's what Latent Composite's x/y are for.
It ships with ComfyUI core, nothing to install, no model files. For a node with four integer inputs it enables a surprising amount of the two-pass workflow universe - outpainting, reframing, regional detail passes - which is why it shows up in so many "how do I extend my image" walkthroughs.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LATENT | — | |
| width | INT | 51264–16384 | — |
| height | INT | 51264–16384 | — |
| x | INT | 00–16384 | — |
| y | INT | 00–16384 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |