bootchk / resynthesizer

Suite of gimp plugins for texture synthesis
GNU General Public License v3.0
1.47k stars 163 forks source link

How to use Resynthesizer to remove things from images? #21

Open Macil opened 9 years ago

Macil commented 9 years ago

It used to be that I could select part of an image, hit Filters->Map->Resynthesize, hit Ok, and then the selection would be cleanly removed from the image. That was on some older Ubuntu version with the gimp and gimp-resynthesizer packages installed a few years ago.

Now I have GIMP 2.8.10 installed from the Ubuntu repos. There is no gimp-resynthesizer package anymore, so I got it from here and compiled this myself. Resynthesizer shows up under the Filters->Map menu just as it did before, but now when I use it, it doesn't remove the selected item. It just kind of uselessly warps it instead, without using the surrounding imagery. Here's an example of what happens when I use it on someone's face. Before, after. This is definitely not how I remember it working. I remember it more like this: https://www.youtube.com/watch?v=EvFLCRywh7g

What am I doing wrong? Is there a different menu option to use Resynthesizer to remove things from images? Was it renamed? Do I have some setting set backwards? Did I miss something in the documentation? (I'm making this an issue here because the docs seem a bit weak and I can't be the only one with this issue.)

bootchk commented 9 years ago

Use Filters>Enhance>Heal Selection. It is a separate plugin from Filters>Map>Resynthesize. It will do what you want. It should be part of the same package you downloaded, as well as several other plugins that also provide simplified user interfaces to the resynthesizer engine (such as "Heal Transparency").

These two plugins are both just user interfaces to the engine. Heal Selection has a simpler user interface (it doesn't show all the parameters to the engine.) Resynthesize shows you all the parameters, and you must understand more.

The main thing you must understand is that the API to the engine changed from version 0.16 to version 1.0. Formerly, the selection was the target (what is resynthesized) and the inverse of the selection was the context (the source of pixels.) After version 1.0, that changed: you must pass a separate layer for the context, and the selection in that layer is the source (or the entire layer if there is no selection.)

So if you try to use Resynthesize using old recipes (like you did, without cloning the target layer and making a new selection for the context), it uses the same layer and the same selection in that layer as both the target and the source. In other words, the artifact you are trying to remove is also the source of pixels, so the effect is NOT to remove the artifact, but just to rearrange it.

This has been discussed before and eventually the old recipes will fade into obscurity.

Macil commented 9 years ago

I don't have a Filters>Enhance>Heal Selection menu item. I installed resynthesizer by cloning this repo and running "./autogen.sh; ./configure; make; sudo make install". Should it have been installed?

bootchk commented 9 years ago

Oops, you are right, that is an issue. The make scripts don't install the Python plugins (Heal Selection is a Python plugin that calls the C language resynthesizer engine.) The README discusses installation for a pre-built (compiled) distribution. You just need to copy the Python scripts to GIMP's plugin directory (depends on the platform) and restart GIMP. You also need a Python interpreter on your system.

You could also clone your layer, inverts it's selection, and pass that cloned layer to Filters>Map>Resynthesizer as the "Source" (or Context? I can't remember the exact wording), which is what the 'Heal Selection' plugin does behind the scenes, to simplify the user interface.

If I can find the time I should improve the build scripts.

rsp commented 9 years ago

@AgentME If you're using Ubuntu 14.04 then you can install the gimp-plugin-registry package:

sudo apt-get install gimp-plugin-registry

It's a repository of optional extensions for GIMP that contains Resynthesizer 2.0 and many more - see:

apt-cache show gimp-plugin-registry
hamoid commented 9 years ago

You just need to copy the Python scripts to GIMP's plugin directory (depends on the platform) and restart GIMP. You also need a Python interpreter on your system.

Copy the Python scripts AND make them executable, otherwise they don't show up in the menu.