What is Detailer?

Stable Diffusion 1.5 works best with images around 512-768px. If you draw a full-body shot at that resolution, each person's "face" only gets about 30-50px.

Resolution is part of the problem, but the face is also just tiny relative to the whole image, so for the AI it becomes overly "fiddly work." Just like people, AI isn't good at fiddly work.

So someone had an idea: why not just cut out the face, redraw it, and paste it back into the original image?

This sequence of "crop → enlarge → inpaint → paste back into the original" is called a Detailer.


Why is Detailer necessary?

You might think, "Why not just upscale the whole image and inpaint it?"

However, the computational cost of inpainting is determined by the size of the original image, not the size of the mask. With a 4K image, even if you only want to repaint the face, you pay for computing the entire 4K image, which is very wasteful.

A Detailer crops out only the area around what you want to inpaint, so nothing is wasted.


Custom Node

Most people use the Detailer node from the Impact Pack. It does more, since it can automate everything up to object detection, but it has lots of its own parameters and is hard to learn, so I'll cover it separately.


Mask and Crop Region

First, let's go over the difference between the mask and the crop region.

  • Mask: The part you actually want to redraw (the face itself, etc.)
  • Crop region: A "working canvas" made by expanding the mask or BBOX a little

A Detailer is inpainting done only within this crop region.

✂️ Inpaint Crop

inpaint_crop_improved.json

As you can see from the workflow, when you pass in a mask + original image, it automatically builds a crop region from the mask with a bit of margin added, and resizes just that part to the size you specify.

There are quite a few parameters, but usually you only need to pay attention to these.

Parameter Name Role/Meaning
mask_fill_holes Automatically fills small holes (missed spots) in the mask
mask_expand_pixels Expands the boundary of the mask outward by specified pixels
mask_invert Inverts the mask
mask_blend_pixels Blurs the mask boundary.
🔥context_from_mask_extend_factor Sets how much margin to add, as a multiplier, when building the crop region from the mask
🔥output_target_width Output width after cropping (pixels). For example, the width of the face canvas
🔥output_target_height Output height after cropping (pixels). For example, the height of the face canvas
output_padding Adds padding when needed so the resolution is a multiple of this value

✂️ Inpaint Stitch (Improved)

inpaint_stitch_improved.json

The ✂️ Inpaint Stitch (Improved) node puts the edited crop back where it came from.

Only the masked part is written over the original image.


Manual Detailer with Inpaint Crop and Stitch

Now let's actually try a Detailer. That said, all you do is add it to the inpainting workflow.

detailer_inpaint_crop.json
  • 🟩 Adjust output_target_width/height to suit the base model.
    • This one uses SD1.5, so 512px.
  • 🟥 This isn't directly about Detailers, but Inpaint Crop outputs a "mask with blurred edges," so it pairs really well with Differential Diffusion, which can take advantage of that.

Combining with Object Detection

Let's automate things a little by generating the face mask automatically.

detailer_inpaint_crop_sam3.json
  • 🟦 Create a face mask using SAM 3.

That's all there is to Detailer basics, so you should be able to put it to good use now. But if you want to detect several people in an image and process them all in one go... you'll need ImpactPack.

→ Detailer ImpactPack (WIP)


Samples