How to remove backgrond using a photo with only the background? (GIMP/others)

I’m trying to remove the background from a photo with a subject, but I would prefer not need to use this kind of techniques to select the background. Some magic-fu would select the shape since it’s easy enough to identify the subject from two identical pictures, one with and another without the subject.

(Just as an additional point, in the link above the background is very simple so it is easy to use the magic-wand; a more complex background would not be so easy to deal with. However, if the technique I’m looking for exists, I would expect the same level of difficulty for both backgrouns)

In pictures:

I have both, “just background”
Background

and “background with subject”
Background with subject

Which were, in the real case, obviously obtained through photographing and not digital editing.

I thought it would be possible to do this automatically if I had a picture of the background without the subject. Sort of, programmatically, remove every repeated pixel and only keep the different ones.

Although this makes sense to me I can’t find instructions on how to do this. Maybe because I don’t even know how to search.

Background to greenscreen doesn’t seem to be it.

I’m using GIMP, but if you know how to do it using other application, I can try to “convert” the instructions.

Answer

It might be possible to import both images as layers and apply a “grain extract” blending mode to the top image. If the pixels on the top layer and bottom layer were identical, i.e. in the exact same position, at the exact same exposure, perfectly aligned, at the same focus, and with no movement whatsoever. Then the identical pixels in the top would cancel out the identical pixels in the bottom leaving you with a 50% grey background, which theoretically you could select using the Select by Colour tool with the threshold set very low. Then you could use that selection to create a layer mask.

Here’s an example:

Example showing Grain Extract and Mask creation

Then apply the selection as a layer mask to the original image

Layer mask applied

Like your examples, I simulated these two shots digitally, and the backgrounds are identical down to the pixel level.

In the real world however, the chances of getting two photos with the exact same pixels in the background, are next to zero. Especially if the background is something in the natural world – leaves move in the wind, and waterfalls move, even cameras on tripods can move. Any slight misalignment would mean the pixels would not cancel out as a smooth grey, making the selection more difficult. It could possibly work in a studio where you could control every aspect of a shot, using a tripod, flash, a remote so you don’t have to physically touch the camera to fire the shot, manual focus and manual exposure mode, etc.

You get where I’m going with this I hope . . . it’s not very practical. That’s why methods such as greenscreen were invented. That’s why it’s used for video, where there might be thousands of frames in a shot that lasts only a few minutes.

Attribution
Source : Link , Question Author : Fernando César , Answer Author : Billy Kerr

Leave a Comment