DEV Community

Nuco Z
Nuco Z

Posted on

How I Remove People From Photos Without Ruining the Background


Have you ever taken a photo that was almost perfect, only to notice someone you didn't want in the background?

A stranger walking through the shot.

Someone standing behind you.

A person appearing in the corner at exactly the wrong moment.

The frustrating part is that the photo itself is usually fine. You just want to remove one thing.

But removing a person is only half of the problem.

The harder part is making the background look natural afterward.

I’ve been working on a simple way to handle this using AI, and along the way I found a few things that make a surprisingly big difference.

Start with the original photo

The first thing I recommend is using the highest-quality version of the original image you have.

It might sound obvious, but the surrounding image gives an AI removal tool important information about what should replace the person.

A person standing in front of a plain wall is relatively straightforward.

A person standing in front of a complicated background is a completely different problem.

Before editing, I usually keep the original image untouched and work on a separate copy.

Select the entire person

One of the easiest mistakes is selecting only the obvious part of the person.

If you want to remove someone, try to include their entire body.

That means their head, hair, body, hands, legs, shoes, bags, and loose clothing.

Otherwise, you may end up with something strange like a hand or shoe remaining in the final image.

At the same time, don't make the selection unnecessarily huge.

If there is another person standing nearby, selecting too much can affect parts of the image you actually wanted to keep.

Give the selection enough room, but stay aware of what's around it.

Don't forget the shadow

This is probably the detail people notice only after they have already removed the person.

Imagine removing someone from a beach photo.

The person disappears.

But their shadow is still sitting on the sand.

Something immediately feels wrong.

The same thing can happen with shadows on roads, floors, walls, or other surfaces.

So before removing someone, look around their feet and underneath their body.

Ask yourself:

What else in this photo exists because this person is here?

Sometimes removing the shadow or reflection makes as much difference as removing the person itself.

Be careful when people are close together

Removing one person from a crowded photo is much harder than removing someone standing alone.

If two people are next to each other, a large brush can easily include part of the person you want to keep.

The same problem can happen around faces, hands, bags, signs, railings, windows, and other objects.

For these situations, I prefer using a more controlled selection.

The goal isn't to make the biggest possible selection.

The goal is to tell the AI exactly what needs to change.

Look at the background, not just the person

After the removal is finished, don't immediately decide that the result is good just because the person is gone.

Look at the background.

Does the ground still look natural?

Did a straight line suddenly move?

Is a texture repeated?

Did something near the person change unexpectedly?

Does the surrounding area still make sense?

I like to check the image at two different levels.

First, look at the entire photo normally.

Then zoom into the edited area.

The first view tells you whether the image feels natural.

The second helps you find small problems.

Some backgrounds are much easier than others

AI image removal works particularly well when there is useful information surrounding the object being removed.

Simple backgrounds such as sky, walls, roads, sand, grass, and floors can be easier to reconstruct.

Complicated backgrounds are more difficult.

For example, imagine someone standing directly in front of a sign.

The entire middle section of the sign is hidden by the person.

There may be no visible information showing what was actually behind them.

An AI model can create a plausible continuation, but it cannot know with certainty what was originally there.

This is an important thing to understand about AI image editing.

The goal is often to create something that looks natural, not to recover pixels that no longer exist.

What I use for quick edits

For a simple removal, I don't really want to open a full image editor and spend several minutes setting everything up.

Usually I just want to upload an image, mark the unwanted area, and see the result.

That's why I built ImgEraser.

It focuses on one simple workflow: upload an image, brush over the person or object you want to remove, and let AI reconstruct the selected area.

You can try it here:

https://imgeraser.com/

The interesting part isn't just the AI model.

The editing workflow matters too.

If the selection is wrong, even a good model can produce a bad result.

If the selection is accurate and there is enough surrounding information, the result can be much more convincing.

What if the first result isn't good?

Don't keep editing the already-edited image.

Go back to the original.

Then change the selection.

If part of the person is still visible, make the selection slightly larger.

If something nearby was accidentally changed, make it smaller.

For complicated images, you can also think about different parts of the image separately instead of trying to solve everything with one enormous selection.

And always keep the original

I know this sounds obvious, but don't overwrite your original photo.

Keep the original and save the edited version separately.

That way you can compare the two versions or try another approach if the first result isn't what you wanted.

The best AI edit is the one nobody notices

This is probably the part of AI image editing that I find most interesting.

The best result isn't necessarily the one that looks the most "AI generated."

Actually, it should be the opposite.

If someone looks at the finished photo and doesn't notice that anything was changed, the edit has done its job.

That's the idea behind ImgEraser.

Not trying to replace a professional image editor.

Not trying to add hundreds of editing controls.

Just making one annoying photo-editing task a little easier.

If you have a photo with an unwanted person or object in it, try it with your own image:

https://imgeraser.com/

I'm especially interested in the difficult cases.

Crowded backgrounds, reflections, detailed patterns, overlapping people, text, and anything else that produces an unexpected result.

Those cases are much more useful than a perfect example because they show where the experience still needs improvement.

Top comments (0)