GMIC plugin - Inpaint patch-based

I’m intrigued by the results shown by Pat David in his tutorial for the GMIC plugin’s Inpaint [patch-based] repair method. I’m trying to follow along using Gimp 2.9.3 on Linux Mint Debian, and the plugin is version 1.6.9 pre#121915

From the tutorial it seems I just select a portion of the image I want to replace, perhaps modify some parameters and then after OK/Apply something will happen, however in my case the image is not modified. The Gmic plug-in dialog disappears for a moment and returns, with no change to the input image. The (verbose setting) console output shows the method invocation:

[gmic_gimp]./apply/ -v -99 -gimp_inpaint_patch 16,16,0.1,1.2,0,0.05,10,1,255,0,0,255,0

but no error messages. What am I missing? Thanks!

I’ve noticed that at the base of the Gimp window that I should “click+drag to replace current selection” but I haven’t found the the correct selection + click mechanism yet. So I’m still floundering. I’m sure this is dead easy, but …

The way I got it to work was using the mask color. I think it’s enabled by default and set to pure red. So I would just paint some #f00 over the part and then run Inpaint [patch-based]. Hacky but works for me. :smile:

Thanks for the reply. I selected a portion of the image, filled my selection with #f00, which then shows as a red rectangle. I ran the plugin with the output as a new layer, and it created a new layer, which contains only the red square of my original selection, complete with “marching ants”. Still a mystery as to how this works. Am I meant to create a layer mask with the selection first?

Try to run it without the selection. As far as I know the selection constrains the input to the plugin. So if you give it only the red square there is nothing for it to sample from. It can still be useful to limit the area that it takes it’s patches from for performance and to avoid glitches.

In a nutshell, the algorithm will replace a section of the image that has been painted with the mask color in the dialog (pure red is the default I think).

[edited thanks to @Jonas_Wagner]
To test:

  1. Open your image
  2. Select a region to inpaint
  3. Bucket fill with red, RGB( 255, 0, 0 )
  4. Run the plug-in.
  5. voilà?

I use a new layer on top of my image, and set the input of G’MIC to “All visible layers”, but test it first with just doing it straight on a single layer.

I need to select all or deselect between 3 and 4 for it to work.

1 Like


My conceptual error was thinking of the selection as the area to be replaced. Instead, it appears that:

  1. the red painted portion is the area to be replaced
  2. the current selection is the “donor” area, that is, the area from which the plugin finds fill information. This works with selection: all, none, or something else.

Thanks Jonas and Pat, I can now play with this to my heart’s content!