Qwen Edit Measure Drift
How far did Qwen actually move your image? This node gives you the number
- source
- edited
- edit_mask
- drift_x_px
- drift_y_px
- warp_params
Everyone knows Qwen-Image-Edit drifts. Nobody knows by how much, because "the whole image looks slightly off" isn't a number. This node is the tape measure: feed it the original and the edit, get back drift_x_px and drift_y_px in source pixels.
It's the least glamorous of the trio and the one I'd wire in first. Measuring the drift tells you whether you're chasing a 2-pixel offset you can ignore or a 9-pixel skew that's ruining every face in a chain of edits - and it hands you a warp_params string you can feed straight into the compositor instead of fitting twice.
How it works
It's classic image registration, no model involved. Both images get converted to grayscale and put through a coarse-to-fine fit on a pyramid up to a 1024-pixel longest edge; a phase-correlation guess seeds the search, and a reweighted Gauss–Newton loop refines it. translation solves for 2 parameters, affine solves for 6 - scale, rotation and shear on top of the offset.
Regions you exclude are excluded from the fit, not just from the output. That matters: the whole trick only works because there's enough unchanged, textured background to lock onto. Positive drift_x_px means the edited content moved right, positive drift_y_px means down - so if Qwen nudged your subject left, expect a negative x.
The inputs that matter
source/edited- original, then the edit.mode-translationfor the usual case,affinewhen the edit also grew or rotated. With affine, the numbers describe movement at the image centre, so don't read them as "the corner moved this far".edit_mask- optional, and worth connecting when you have it. White is excluded from the fit, so the thing you asked Qwen to change stops dragging the alignment around.ignore_border_px(8) - kills border artifacts (and gets reduced automatically for tiny images).
So the practical recipe: connect the mask you used for the edit, run it once, read the numbers, then wire warp_params into Qwen Edit Align Composite so the expensive fit happens once and both nodes agree.
Outputs are drift_x_px (FLOAT), drift_y_px (FLOAT) and warp_params (STRING). There's no image output - it's a measuring instrument. The floats are handy if you gate a workflow on drift, or if you just want to know whether 2511 actually improved anything on your own images.
Install
ComfyUI Manager → search WepeNerd, or:
cd ComfyUI/custom_nodes
git clone https://github.com/WepeNerd/ComfyUI-WepeNerd
python -m pip install -r ComfyUI-WepeNerd/requirements.txt
Restart and hard-refresh. Learn the WepeNerd/Qwen Edit Align category name - all three of these nodes live there and none of them download anything. The pack does need SciPy and PyAV installed (that's what the requirements file is for); skip it and the whole pack fails to import, so you'll see no nodes rather than one broken node.
Where people get burned
Batches. This node reports exactly one pair, and it will raise Measure Drift reports one image pair rather than quietly averaging a batch. Select the pair you care about - the compositor handles batches directly if that's what you need.
Flat backgrounds. Blown-out sky, seamless backdrop, or an edit_mask that covers nearly everything: the fit has nothing to grab, the node logs a warning and returns zero drift. Zero here often means "couldn't measure", not "no drift". Check the console.
Trusting one number for a whole workflow. warp_params are measured at a specific image size. Reuse them on the same geometry; re-measure if you changed resolution or aspect ratio, because affine terms do not scale the way you'd hope.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| source | IMAGE | — | |
| edited | IMAGE | — | |
| mode | COMBO | 2 options: translation, affine | |
| ignore_border_px | INT | 80–256 | — |
| edit_maskopt | MASK | Region that was meant to change (excluded from the fit). |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| drift_x_px | FLOAT | — |
| drift_y_px | FLOAT | — |
| warp_params | STRING | — |