SDXL Micro-Cond (Advanced)
Tell SDXL it's a different size — the manual micro-conditioning dial
- conditioning
- CONDITIONING
Ever generate an SDXL image where the subject's face gets sliced off at the frame edge, no matter how you word the prompt? That's not a prompt problem - it's a conditioning problem. SDXL doesn't just see your text. Alongside it, the model is told five numbers: the size of the "original" image, where it was cropped, and the target output size. Nudge those and you change how the model frames things - fix the decapitations, keep the subject off the edge, or make an upscaled canvas feel composed instead of stretched.
This node is the manual dial for those five numbers.
Why you'd reach for it
ComfyUI's built-in SDXL text encoder (CLIPTextEncodeSDXL) stamps those size/crop values into the conditioning the moment you encode. What this node gives you is the ability to rewrite them after encoding, without re-running the text encoder and without touching your prompt. You encode once, then tweak the framing math independently. If you've been fighting composition by editing prompts and hoping, this is the more direct lever.
The mechanism is refreshingly honest. SDXLMicroConditioningAdvanced takes your conditioning, deep-copies the metadata dict on each entry (so it never mutates your original positive/negative streams), overwrites the five fields, and hands back a fresh CONDITIONING. Pure Python, no model files, no sampling math. It's a rewrite, not a re-encode.
The inputs that matter
Six integers, and only three of them are interesting to a beginner:
- original_width / original_height - the "this was the real size" number. Set these larger than your actual output and SDXL thinks the frame you're drawing is a crop of a bigger image, which is exactly what stops subjects from being chopped at the edges.
- crop_left / crop_top - the crop offset into that imaginary original. (The code maps these to SDXL's
crop_w/crop_hunder the hood.) Non-zero here tells the model the frame isn't centered on the original. - target_width / target_height - what the model should believe the output size is. They step by 8 for a reason: everything has to stay a multiple of the VAE's latent scale.
There's one output, a CONDITIONING, and it plugs straight into the positive and negative inputs of your KSampler.
Install and gotchas
Install is a thirty-second job. In ComfyUI Manager, search "SDXL Micro-Conditioning" and hit install - or drop it in by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/lRemixl/ComfyUI-sdxl-micro-conditioning
Then restart ComfyUI. There are no dependencies - no requirements.txt, no model downloads, nothing. The two nodes land in advanced/conditioning.
Where people get burned:
- It only changes conditioning, not your actual canvas. If you set
target_widthto 2048 while your Empty Latent Image is 1024x1024, you've told the model to draw a 2048px frame while sampling a 1024px image. That mismatch produces garbage or nothing. Keep target values consistent with your actual latent. - The effect is subtle. Crop conditioning is a nudge, not a lever. Plenty of people try it and conclude it's broken (there's a whole Reddit thread titled "Is SDXL Crop Conditioning just... not working?!"). You'll see framing and edge-composition change, not a new image.
- Wire it into both streams. If you only patch the positive conditioning, your negative conditioning still carries the old size values and the two fight each other.
- SDXL-family checkpoints only. Works on SDXL, Pony, Illustrious and their derivatives. Flux and SD 1.5 have no micro-conditioning to lie to, so the node does nothing useful there.
Think of it as a cheap composition experiment before you commit to hires fix or a different aspect ratio.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning | CONDITIONING | — | |
| original_width | INT | 10240–8192 | — |
| original_height | INT | 10240–8192 | — |
| crop_left | INT | 00–8192 | — |
| crop_top | INT | 00–8192 | — |
| target_width | INT | 10240–8192 | — |
| target_height | INT | 10240–8192 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |