Patch Based Inpainting

(Stampede) #1

Kubuntu 18.04
GIMP 2.10.4
GMIC 2.3.3

I am having a hell of a time getting any decent results from GMIC’s “In Painting” repair tool. A lot of times, the preview looks good, but when I run the filter, it looks like hell with bits and pieces of the object I’m trying to remove scattered and distorted throughout the image.

I have a NSFW picture I’m working on, but here is a G-rated example. I can post the other if it’s OK with the boss @patdavid . This result is actually better than most of my tries to use this so far. Moving the GMIC sliders around does not seem to affect the preview at all. So what I’m saying is I think the preview for this filter has a lot of problems, since the final result doesn’t reflect the preview. The preview will also change depending on zoom level.

I love the GMIC filter pack, but I wish they had documentation for their filters somewhere.

All that said…any opinions on the best way to remove these signs from the picture?





I left all the sliders at their defaults, because changing them was not changing the preview anyways.

What does lookup factor do in G'MIC inpaint [patch-based]?

I’d say this is a case for the clone tool, but even with that it will be hard work


Sadly, the preview does not reflect the outcome. What you see is rarely what you get.

You may be missing the step where you select the region you would like G’MIC to consider. In other words, paint over what you would like to replace and also select the areas you would like the plugin to draw from.

( #4


Using 2 mask and this parameter:

GNU/Linux Mint 18
GIMP 2.8
GMIC 2.3.3

(Stampede) #5

It’s too bad the preview does not work well. But at least I know there’s nothing I can do about it.

And you’re right - I did not know that I had to select the source area. I only painted the red mask and deselected everything. When I do the selection, does it matter if it includes the red mask? Or should I remove the mask from the area that I selected?


The selection should encompass the red mask and the area outside of it where the algorithm would do the sampling. You may have to do this multiple times from top to bottom because vertically the adjacent patches are different; e.g., grass, brick, panelling, etc.

(Stampede) #7

Ah, very important tip. Thank you!!


I wish preview was what you get, but this isn’t true for any programs with access to G’MIC.

(Pat David) #9

I have no issues with nsfw personally, and I think we’re all adults here for the most part… :wink:

Part of the problem I think is when hard features are obscured that have strong geometric lines. We can pick out a mis-placed alignment quickly. This is exacerbated if the missing features occur in more than one single direction.

For a quick example, the top-left edge of the green door in the background. There is literally nothing nearby for the image to even attempt to re-create what the corner of a door should look like. :frowning: The same thing for the white area above the top light:


I would personally approach this in a couple of other ways (or possibly both depending on how much time I wanted to spend on it):

  1. Clone brush + Heal brush + patience. (About 3-4 minutes quickly):

  2. Judicious application of inpainting by region (remember, Patch Size is the size of the area to be copied from, while Lookup Size is how far away from the area to look.

  3. A combination of 1. and 2. - where you use inpainting for regions where it’s strong to quickly build the inpaint, and spend your time on more complex areas with clone + heal. Here’s a quick pass in a couple of places with inpainting that only took a minute or two. Then go build the detail you need manually to finish it.

Hopefully that makes some sense. This also changes depending on source resolution and how much you care about the results. :slight_smile:

Feel free to link/upload your nsfw image if you want us to work on it a bit and offer any advice.

[edit] - also, more what @afre already said about selection + mask… (forgot about that because I’m forgetful, and it’s solid advice to get better results).