✦ The Diffusion Guide · ch.5 · controlnet & img2img
🎨 Chapter 5 · ControlNet & img2img

Steer with a picture

Prompts are great at deciding WHAT is in an image and terrible at deciding WHERE. This chapter hands the model a picture instead of more adjectives β€” repaint it, patch one corner, or trace over its bones and redraw everything else.

Four chapters in, you can steer with words (the prompt), knobs (steps, guidance, seed), and patches (LoRA). There's a fourth steering wheel, and it's the one you reach for the moment you care about composition: hand the model a picture.

Three tools, escalating in how tightly they hold on: img2img repaints a whole image, inpainting repaints one region, and ControlNet keeps only the structure and redraws the rest. By the end you'll know exactly which wheel to grab for a given job.

1Words place things badly

Try to art-direct with adjectives: "a cat on the LEFT, a lighthouse in the BACK, sun in the top-right corner." Generate it a dozen times and the cat wanders, the lighthouse floats, the sun does whatever it likes. The model treats layout words as vibes, not coordinates.

Chapter 1 told you why. The text encoder turns your prompt into a bag of numbers β€” it captures what you asked for beautifully, but geometry mostly doesn't survive the trip. "Left", "behind", "top-right" arrive as faint suggestions, not a floor plan. Crank guidance and you don't get better placement; you get a more saturated version of the same misplacement.

So when you care about where, stop adding adjectives and add a second input channel: an image. Three tools, in order of how much of the source they keep:

  • img2img β€” hand over a whole picture; the model repaints all of it, more or less faithfully.
  • Inpainting β€” hand over a picture and a mask; only the masked region gets repainted.
  • ControlNet β€” hand over just the structure of a picture; the model keeps the bones and repaints everything else freely.
🧭
The whole chapter in one line: words decide what, pictures decide where. Once placement matters, the fix is never a longer prompt β€” it's a second channel the model can't ignore.

2img2img: erase partway, then denoise back

Remember Chapter 1's loop β€” guess the noise, subtract a bit, repeat. Plain txt2img starts that loop from step 0: pure static, nothing but a seed. img2img starts it somewhere else. It takes your image, adds noise partway back β€” erasing some of it β€” and then runs the exact same denoise loop from that half-erased state.

One dial governs the whole thing: strength, i.e. how much of your image gets erased before the repaint begins.

  • 0.2 – 0.35 β€” barely erased. Composition and palette survive; you're just repainting the surface in a new style. This is Chapter 4's anchor move.
  • 0.5 – 0.65 β€” the gist survives: rough layout and subject, everything else prompt-side.
  • 0.75+ β€” only a rumor of the original is left; at 1.0 you're back to txt2img.

Here's the quiet gotcha: img2img actually runs about strength Γ— steps of the loop, not all of them β€” because it skipped the early ones by starting partway. So very low strength barely does anything by design. Drag the dial and watch the repaint zone shift:

Interactive Β· the strength dial Drag from repaint to unrelated
your source
β†’
img2img output
repaint remix rumor unrelated
steps actually run: 11/30
strength 0.35 Β· repaint zone β€” composition kept, style replaced

3img2img workflows that earn their keep

Three recipes that make img2img worth a permanent slot in your workflow:

  • Sketch β†’ render. Block out the composition yourself β€” MS-Paint level is fine, coloured blobs where things go β€” then run it at strength ~0.6. You supply the where; the model supplies the finish. This is the single best answer to "the model won't put things where I want."
  • Style transfer. A photo you like + your Chapter 4 style block + a style LoRA, at strength ~0.4. The photo keeps its bones; your look paints over it.
  • Iterate on a winner. Take your best output, feed it straight back at strength ~0.3 with a slightly tweaked prompt. The safest "same but better" move there is β€” you nudge one thing without rerolling the whole composition.
⚠️
Re-feeding compounds. Each pass adds and removes noise, and the losses stack up like re-saving a JPEG over and over β€” colours drift, detail smears. When you notice the drift, go back to the original and take a fresh single hop, not the tenth generation of a generation.

4Inpainting: repaint only this bit

img2img repaints the whole frame. Often you only want to fix one corner β€” the classic broken hand, an ugly sky, a photobomber in the background. That's inpainting: you paint a mask over a region, and the loop runs as normal, except at every step only the masked pixels are allowed to change. Everything outside the mask is clamped back to the original, step after step. The rest of the picture comes out bit-identical.

Paint a mask below β€” drag across cells, or tap a preset β€” then hit Generate. Only the masked region is repainted; watch the unmasked pixels stay exactly put:

Interactive Β· inpaint the sky Drag to paint a mask Β· then Generate
mask: 0% of image Β· unmasked pixels: unchanged

Two craft notes that separate clean inpaints from obvious ones:

  • Mask a little generously. Overshoot the edge of the thing you're replacing. The model needs elbow room around the boundary to blend the new region into the old one β€” a tight mask leaves a visible seam.
  • Describe the whole scene, not just the patch. The prompt for an inpaint should read like a caption for the finished picture (or at least the region in context), so the repaint matches its surroundings. Prompt only "a hand" and you'll get a hand that ignores the arm it's attached to.

Outpainting is the same trick pointed outward: extend the canvas past its edges, mask the new blank margin, and let the model continue the picture into it. Same clamp, same loop β€” you're just inpainting the outside. DiffusionBee ships img2img and inpainting built in; the buttons move between versions, so treat the exact UI loosely.

5ControlNet: tracing paper for the model

Here's the job img2img can't do. You want the exact pose and layout of a source image, but a completely different picture β€” new palette, new medium, new subject skin. Low strength keeps the structure but also keeps the old look; high strength changes the look but erases the structure right along with it. There's no strength value that keeps one and drops the other.

ControlNet splits them apart. Plain version first: it extracts just the bones of your source β€” the edges, or a stick-figure pose, or a near/far depth map β€” and pins the denoise loop to those bones, while the prompt and your LoRAs repaint everything else freely. It's tracing paper: your lines stay put, the drawing on top of them changes completely.

Pick a control type, a style, and a weight, and watch the same bones become three different drawings:

Interactive Β· same bones, different drawing Change the map, the style, and the weight
source
weight
pose map Β· weight 1.0 Β· locked to the bones

Now the one paragraph of machinery, since you've earned it. A ControlNet is a trained copy of the U-Net's encoder half that reads the control map and, on every denoise step, nudges the guess toward "…and match these bones." It's Chapter 1's loop with a chaperone whispering the structure at each step. Crucially, the model's original weights stay frozen β€” the ControlNet only adds. That's why ControlNets are separate downloads that compose with any prompt and any LoRA stack (Chapter 3): structure and style are independent add-ons you mix at will.

6The control types

Different maps keep different amounts of the source. You pick the one that encodes only what you care about β€” everything it doesn't encode, the prompt gets to invent.

Reference Β· pick the right map
Control mapKeeps…Reach for it when…
Cannycrisp edge outlinesproducts, architecture, or keeping a drawing's exact linework
Deptha near/far mapyou want the scene layout and camera feel without inheriting hard edges
OpenPosea stick-figure skeleton"same character, new pose" β€” nothing else about the source survives
Scribbleyour doodle, looselyyou have a rough shape in mind and want maximum freedom around it
Lineart / Soft-edgegentle outlinesyou want Canny's idea but softer, less rigidly traced

The rule of thumb: pick the map that keeps only what you care about. The less a map encodes, the more room the prompt has to work. OpenPose throws away everything but the skeleton β€” perfect when only the pose is sacred. Canny keeps every edge β€” perfect when the linework is the point, and a straitjacket when it isn't.

7ControlNet's knobs

Two dials shape how hard the trace holds β€” and you met the logic behind both in Chapter 2.

  • Weight β€” how firmly the trace pins the loop. Around 1.0 the output obeys the map; below 0.7 it's a gentle suggestion the prompt can overrule; push it too high and you get a stiff, embossed look with the map's own lines ghosting through the final texture. (You saw exactly this on the weight slider above.)
  • Start / end steps β€” when the chaperone is in the room. Chapter 2's insight: early steps decide composition, late steps decide texture. So end the ControlNet's influence at ~60–80% of the steps β€” it locks the layout in the early passes, then lets go so the final passes polish freely. That's the practical cure for stiffness.

And here's the payoff: ControlNet stacks with everything else in this book. Structure from the ControlNet + style from a LoRA (Ch.3) + consistency from Chapter 4's frozen recipe = the whole guide firing in a single generation. Structure, look, and reproducibility, each on its own dial.

πŸ“¦
ControlNet arrived in DiffusionBee in recent versions for some model families. If your build doesn't have it yet, the concept carries over unchanged to any Stable Diffusion tool β€” and it's worth updating for.

The three tools, as one function

All three tools are the same generate function under the hood. They only change two things: where the loop starts, and who's chaperoning it. txt2img starts from static with no chaperone; img2img starts from your half-erased image; ControlNet starts from static again but hands the loop a control map. Flip between the languages β€” the shape is identical.

8Choosing your steering wheel

You now have four ways to steer, and they don't compete β€” they answer different questions. The decision comes down to how much of a source you want to keep:

Reference Β· which wheel to grab
You want…Reach forKey dial
the same image, restyledimg2imglow strength (~0.3)
to fix one regioninpaintinga generous mask
the same structure, everything else newControlNetweight + end-step
the same face / character across imagesa LoRA (Ch.4)weight β€” add OpenPose for pose

That's the last wheel. You started with pure static and a single seed, learned the knobs that shape it, the patches that bend it, a style that's genuinely yours β€” and now the pictures that place it. Words, knobs, patches, and pictures: you have every steering wheel the model offers. Go point it exactly where you want.