DEV Community

yue xing
yue xing

Posted on

Check whether the subject survived before you check the edges

I needed a set of background-free images for a course project, ran them through the default tier, glanced at the transparent checkerboard, decided they were fine and saved them. Then I dropped one into the slide deck for the presentation, onto a page that happened to have a dark background, and saw the hand was cut off. Not cut off, actually — the entire hand was gone and the bottle was floating.

Original and fast-tier result

Going back to the checkerboard version, it isn't strictly invisible, but it is genuinely hard to see. The hand is pale skin, the checkerboard is pale grey and white, all of it sits in the highlights, and a missing piece barely registers. There's also no obvious stump between what was kept and what was dropped, so it reads as though the photo only ever had a bottle in it. It didn't even occur to me to be suspicious.

So the order needs changing: check whether the subject is complete, then check whether the edges are clean. An edge problem means it looks bad. A subject problem means it's a different picture. The second is far worse and far easier to miss. The checking is four fixed steps, and when something is missing the answer is to switch tiers rather than reach for a brush — those two below.

Step one, on a transparent background, sweep the subject top to bottom looking only at whether the outline is complete, ignoring edges entirely. Step two, switch to a dark background: pale gaps in the subject, pale residue and white fringes all jump out here. Step three, switch to a light background for dark fringes, dirty edges and dark patches that never got removed. Step four, zoom into the complicated regions — hair, gaps between fingers, cap highlights — and confirm. The first three are whole-image sweeps and go fast; only the fourth is slow, which is why it's last.

Mask brush and edge parameters

When I found the hand missing my first move was to paint it back. Ten minutes in I understood this was the dumb option: a missing hand means the model's idea of the subject differs from mine, which is a judgement-level problem, and an edge I paint by hand won't look natural either. Switching tiers and re-running costs a model download and is both faster and better. I moved to the pro tier and the hand came back. Why the same photo gets a different subject judgement from a different tier I haven't worked out — all I know is the two larger tiers both kept the hand on this image and the default one didn't.

Save the brush for genuinely isolated spots. The panel has erase-background and keep-subject brushes plus size, hardness and strength, and the feature page says the brush goes down to 1 px. What worked for me was roughing in with a larger brush and then shrinking it to tidy the boundary. Undo and redo sit next to it, so a bad stroke isn't fatal.

One trap worth calling out, because I fell into it immediately. The edge parameters — edge contraction, mask softening, background colour removal — all default to zero. That isn't an unconfigured tool, it's deliberate: the default path uses the model's raw alpha per pixel and doesn't auto-contract, soften or de-fringe, which the feature page states outright. Seeing three sliders pinned to the left, I assumed I was supposed to set them, dragged all three, and pulled the edge in far enough to make it worse than before. These are remedies for a specific problem, not setup you do first.

Last step, don't skip it: go back to step one and walk it again. Painting and parameter changes both introduce new problems, contraction especially, and it tends to eat something where you weren't looking. I flip black and white one more time after any fix and only export once nothing new has appeared. Once you know the routine it's two or three minutes, which beats discovering the image is wrong during a presentation.

Top comments (0)