Cut (Qwen-Image 2.1) — BlueBox
Hand the edit model a size it won't quietly resample behind your back
- image
- image
- width
- height
- resolution
If your Qwen edit comes back slightly shifted, it's probably the size
The Qwen-Image-Edit line re-emits the whole frame, and it does so at a resolution it chooses - which is why the community's oldest fix for the "everything came back a bit soft and a bit offset" complaint was to control the input resolution yourself. As the community's long-running fix for that complaint puts it, "control the input resolution (a multiple of 112) and the output realigns." Even then, 2509 users reported output that was "slightly misaligned or blurred" at a compliant resolution, which is what pushed people toward crop-and-stitch.
Cut (Qwen-Image 2.1) is this pack's answer for the newer model: it takes whatever size you've got and crops or pads it to a size the pipeline's own internal resize step will leave alone. The author added it in a single commit whose message translates to "add cut node to assist Qwen-Image 2.1 offset-free editing" - a purpose-built helper, not a generic resizer. One honest caveat: 2.1 is recent enough that almost nothing is written about it in the open, so the mechanism below is read off the node's own source rather than from anyone's field report.
How it works
Everything hinges on a "fixed point" size - a width and height the model's preprocessing won't change.
- Build a candidate list. From
resolution, it takesn = resolution / 32and targets an area ofn²32×32 cells. Every(k·32, m·32)pair whose cell product lands withinn × tol_ratioof that target is a candidate. - Score them. Distance from your image's aspect ratio counts 1.0 - how much you'd lose to cropping. Distance from the nearest standard bucket (1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3) counts 0.6. Deviation from exactly
resolution²area counts 0.4. Lowest total wins. - Verify the fixed point. It simulates the internal rescale - scale by
sqrt(resolution² / (w·h)), round each side to the nearest multiple of 32 - and if that returns the same width and height, the pair is stable. If not, it falls back to the closest whitelist pair that is stable. This is the actual point of the node: a candidate that survives the model's own resize untouched means your pixels aren't being resampled a second time without you knowing. - Apply it.
cropscales to cover the target and centre-crops.padscales to fit and centres the result, filling the border withpad_color.
Inputs and outputs
resolution- 512 to 2048 in steps of 32, default 1440. Set this to roughly what your workflow actually renders at. Picking 2048 for a 1024-ish pipeline just means a bigger crop.tol_ratio- 0.2 to 3.0, default 1.0. Higher admits more candidate shapes, so you keep more of your source aspect; lower keeps the area tight and the crop more aggressive. Leave it at 1.0 unless something's clearly off.mode-crop(default) orpad. Crop throws away pixels; pad keeps everything and adds a border.pad_color- 0 to 1, greyscale, 0 = black and 1 = white. It's a float, not a colour picker, so no arbitrary fills.
Outputs are image plus width, height and resolution as INTs. Those three are the real output dimensions, not your input's - handy for feeding a latent or empty-image node so the graph stays consistent, or just for logging what the node decided.
When to use which mode
crop when you're doing the crop-and-stitch dance and only care about a region - the usual crop-and-stitch logic applies, and losing the edges is acceptable because you'll composite the result back.
pad when the whole frame has to survive - a portrait where the subject touches the edge, or a sheet you're extending. But a flat band of colour along one side is image content to an instruction-editing model, and it will often invent something to fill it. Pad only if you plan to crop the border back off.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/zhoutingxi/ComfyUI-BlueBox.git ComfyUI-BlueBox
Restart, then look under BlueBox/Qwen. ComfyUI Manager finds the pack if you search ComfyUI-BlueBox. No pip installs and no model files - the repo's requirements.txt is empty and this node imports only math and torch. It's a pure tensor operation, so it costs nothing to leave in a graph.
Common issues
"It cropped off part of my subject." That's crop working as designed. Switch to pad, or move resolution closer to the area you actually render so less has to be trimmed.
"The output size isn't what I asked for." It won't be - resolution is a target area, and the node picks a shape near it that survives the model's resize. Read the width/height outputs rather than assuming.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| resolution | COMBO | 1440 | 49 options: 512, 544, 576, 608, 640, 672, +43 |
| tol_ratio | FLOAT | 1.00.2–3 | — |
| mode | COMBO | crop | 2 options: crop, pad |
| pad_color | FLOAT | 0.000–1 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| width | INT | — |
| height | INT | — |
| resolution | INT | — |