Gimp-Forum.net
Possible to replace foreground with background? - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: Possible to replace foreground with background? (/Thread-Possible-to-replace-foreground-with-background)



Possible to replace foreground with background? - gimper - 12-04-2017

I'm new; this is my first message.

I'm new to GIMP, but I'm learning everyday.

My question is: 

Is it possible to cut out the foreground of an image and replace the cut out area with a continuation of the background in such a way that the new image looks flawless and continuous?

If the background is just one simple color, this would be easy.

Similarly, if the background is a simple repeating pattern, then this would also be easy.

But what if the background is not simple?

Here's a concrete example of what I mean:

Let's say I take a photo of my friend standing in front of a wooded area with trees and the sky in the background and the green grass at his feet and everything else you would expect to see at the woods.

I can easily cut out my friend's image from the photo.

But is it possible to fill in the empty space where my friend's image was with a continuation of the background in such a way that the resulting image looks as if my friend were never there to begin with?


RE: Possible to replace foreground with background? - rich2005 - 12-04-2017

In my opinion, every image will have to be considered on its own. There are plugins that might help, heal-selection, liquid rescale, as examples, but as mentioned best on regular backgrounds.

At the end of the day, it comes down to how much effort you are willing to spend on your project.

The saving grace with (example) forest / grass type of background is who will know what the original looks like

Much more difficult with say, a street scene or inside a building.

Quick example, copy / paste + clone tool. lump of rock represents 'person'

before https://i.imgur.com/Tk7qKh3.jpg

after: https://i.imgur.com/mMXHv8W.jpg


RE: Possible to replace foreground with background? - Ofnuts - 12-04-2017

(12-04-2017, 10:10 AM)gimper Wrote: I'm new; this is my first message.

I'm new to GIMP, but I'm learning everyday.

My question is: 

Is it possible to cut out the foreground of an image and replace the cut out area with a continuation of the background in such a way that the new image looks flawless and continuous?

If the background is just one simple color, this would be easy.

Similarly, if the background is a simple repeating pattern, then this would also be easy.

But what if the background is not simple?

Here's a concrete example of what I mean:

Let's say I take a photo of my friend standing in front of a wooded area with trees and the sky in the background and the green grass at his feet and everything else you would expect to see at the woods.

I can easily cut out my friend's image from the photo.

But is it possible to fill in the empty space where my friend's image was with a continuation of the background in such a way that the resulting image looks as if my friend were never there to begin with?


Basically, three methods:

  1. You find an unobstructed area of the picture that is big enough to cover the friend, you make a selection, use Select>Feather to smooth the edges, copy/paste move the resulting "floating selection" above your friend and "Layer>Anchor".
  2. It the friend is masking a texture (grass, tree, sand...) you can use the "Clone" tool Clone . Ctrl-click on the source, then paint over the friend. The tool will pick texture data from the source and copy over the friend. If you do this with a smooth/fuzzy brush, it won't be too visible.
  3. In-painting: this uses smart code to "invent" missing texture by looking at the picture surrounding the subject to remove. Two different implementations:
    • The "resynthesizer" plugin, explained/demoed here.
    • The in-painting function in the more general GMIC plugin, explained/demoed here.