Flux Restore And Crop
Get your original canvas back after an outpaint
- image
- cropped_image
- restored_original_image
Outpainting is a two-step lie: you pad the canvas, generate the extension, and then you're stuck with a bigger picture than you asked for. Flux Restore And Crop is the second half of that lie - it takes the outpainted result, crops back to the original image's position, and optionally resizes to the exact original dimensions. It's the bookend to FluxKontextPadForOutpaint, and the two are meant to be used as a pair.
If the pad node is "make the canvas Flux-friendly", this one is "make the result yours again". You outpaint a 1024×1024 to a 1344×1024 canvas, and after the model fills the extension, Flux Restore And Crop either hands you the clean center crop (no resize) or the fully restored original-size image.
How it works
Two inputs drive it:
- image - the outpainted result, padding and all.
- original_width / original_height - the pre-pad dimensions. These come straight from FluxKontextPadForOutpaint's
original_width/original_heightoutputs. That's the intended wiring, and it's why the two nodes have matching field names.
Two outputs, for two different use cases:
- cropped_image - the center crop back to the original region, without resizing. Good when the outpaint kept native resolution and you just want the original framing back.
- restored_original_image - the crop plus a resize back to
original_width×original_height. This is your "exactly the picture I started with, but extended" output - matching the source image's dimensions so it slots into whatever you were doing before the detour.
The inputs that matter
- original_width and original_height - don't type these by hand if you can avoid it. Wire them from the pad node. They default to 1024×1024, which will silently give you the wrong crop if your actual source was different and you forgot to connect them.
Setup
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/PeterMikhai/Doom_Flux_NodePack
Restart ComfyUI, or search "DoomAI Nodes" in Manager. No dependencies.
Where people get burned
- The center-crop assumption. The node crops to center, so it assumes the pad node padded symmetrically. That's exactly what FluxKontextPadForOutpaint does, so in the intended pairing there's no problem - but feed this node a hand-padded image with uneven padding and the "original" crop will be off-center.
- Default 1024×1024. The defaults are just numbers, not magic. If you didn't wire
original_width/original_heightfrom the pad node, you're restoring to 1024×1024 regardless of what your image actually was. cropped_imagedoesn't resize. If your outpaint came out at a different resolution, the crop keeps that resolution. Userestored_original_imagewhen you need exact original dimensions.- Restore after, not before. The whole point is that you run this after generation. Wire it at the end of the graph, after the edit model, before the save.
Same family caveat as its sibling: this is built for the Kontext-style instruction-editing flow, and the Kontext-era FLUX.1 license restricts NSFW work. For legitimate outpaint extension, the pad → generate → restore loop is genuinely pleasant - two simple nodes, matching field names, no manual bookkeeping of "what size was my image again?".
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Результат outpainting (с паддингом) | |
| original_width | INT | 102464–8192 | Исходная ширина (от FluxKontextPadForOutpaint) |
| original_height | INT | 102464–8192 | Исходная высота (от FluxKontextPadForOutpaint) |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| cropped_image | IMAGE | Кроп по центру без ресайза |
| restored_original_image | IMAGE | Кроп + ресайз до исходного размера |