Heal selection (fix to: Smart remove selection)

A fix to the Filter>Enhance>Smart remove selection... script.

Release notes:

Fixed a bug where strange texture (e.g. sky from the top of the image) instead of surrounding texture was synthesized onto the selection, as reported at this website for the resynthesizer plug-in.

Changed the menu item to "Filter>Enhance>Heal selection..." from "Smart remove selection..." (New menu item name is shorter and more descriptive. It doesn't use the Heal tool, but the effect is nearly the same. Note the filename is the same, only the menu item name is changed, and it still requires the resynthesizer plug-in.)

Changed the pop-up help text.

Installation:

Copy file smart-remove.scm to the standard place for scripts. See Preferences>Folders>Scripts for the pathnames. In my case, using Linux Ubuntu, I removed the current version at /usr/share/gimp/2.0/scripts/smart-remove.scm and installed the new version at ~/.gimp-2.6/scripts/smart-remove.scm. (It seems strange that Gimp will not use a script from your home folder if there is also one of the same name in the standard installation folder, but it will for a plugin?)

AttachmentSize
smart-remove.scm4.06 KB

Comments

Selection script still problem and texture depends on screen pos

I'm using Gimp portable in XP
tried even the latest? 0.16 version of resynthesizer http://gimp.foebud.org/node/24255

I notice that when i make a selection even with the new script resynthesizer does takes an area from above.
But i noticed more things go wrong its not only that.

If i make a selection use the tool i get something from the top of my picture
Then i perform an undo of this action so the selection stays the same.
Then i move the gimp window that contains the picture
Move it up left / right / up /down..etc
And each time perform a resynthesize + undo then each filling becomes different

This might indicate that the resynthesizer has a wrong reading of screen pixel location and uses the actual main screen of windows (instead of relative coordinates based on where the window is), or something like that. As It shouldn't matter where the screen is located.

Resynthesizer still problem texture depends on screen pos

The resynthesizer uses the clock for the seed of its random number generator. Therefore, you would expect to get slightly different results each time you use it, even if all other conditions are the same. I think that should be changed.

Are the results are not only slightly different, but "wrong" in some sense? Possibly you are really not using the corrected "Heal selection" script.

There is also a bug where it gives "wrong" results if there is an alpha channel and transparent areas around the selection. Then it seems to heal with black splotches.

Resynthesizer

I am using Gentoo Linux.
I d/led the resynth source code from this link.
http://www.logarithmic.net/pfh/resynthesizer
I did make install and it installed everything correctly.
However resynth didn't show up in Filters>Map.
I opened resynth in ~/.gimp-2.6/scripts and saw that it was compiled for 32 bits while my system and the Gimp are 64 bits.
Looking at the Makefile I noticed the first line contained:
CC = g++.
I checked /usr/bin and found a symlink to g++-4.3.4.
I modified the Makefile to:
CC = g++-4.3.4
and reinstalled.This time it showed up in Filters>Map and was compiled 64bit.
I am not very familiar with other Linux distro's but something similar might happen there.
The g++ compiler is used to produce 32bit code for apps that need it.
Thanks bootchk for your smart remove script.
Gerard.

fix for windows

I took the modified script and just remove the last 2 parameters. they are the only ones that do not match with previous script. Removing them it works perfectly in GIMP 2.6.6 for windows. Procedure: - Install plugin resynthesizer-for-Windows-0.13b - Take the modified script from this thread - change "(plug-in-resynthesizer 1 img layer 0 0 1 workLayerID -1 -1 0.0 0.117 16 500)" by "(plug-in-resynthesizer 1 img layer 0 0 1 workLayerID -1 -1 0.0 0.117)" save script in script directory

RESYNTHESIZER INSTALLING for Gimp 2.6.7 Windows

Hello,

May s.o explain me. How i do this? With the Editor?

- Install plugin resynthesizer-for-Windows-0.13b
- Take the modified script from this thread
- change "(plug-in-resynthesizer 1 img layer 0 0 1 workLayerID -1 -1 0.0 0.117 16 500)"
by "(plug-in-resynthesizer 1 img layer 0 0 1 workLayerID -1 -1 0.0 0.117)"
save script in script directory

Thanks a lot.

that is not for install

it is explained how to modify a script that may use the plugin

Nothing relate to install, you install the plugin as usual(should be a exe file you may just drop it in a plugin folder)

the scripts instead have a different extension (.scm) and should be added to the gimp script folder

they may also be opened with a text editor, as the notepad, to do edits as that suggested

Anyway the script depend from the plugin not vice versa, so RES will works also if the scripts are not installed

trouble with fix for windows

I download and installed gimp 2.6.6 to my computer running Windows XP home. It works great. I download resynthesizer 13b unzipped and patched it in. It works but with sky filled into the removed area. So, I downloaded what is called "modified script" in the original post and modified it by removing two arguments per above using notepad+ and replaced original script with my modified version. This broke something because the script no longer appears in my gimp script fu menus. Can somebody provide direction? Thanks, Greg

notepad

the problem is: notepad! it seems to put any other code into the scm file and currupt it.

thats how I did the change:
download the orginal *.scm
open it in an editor and search for the line above. and just delete the last two digits: 16 500 and save it.
put it into the original standard script folder (programfiles > gimp > share > ...)
and it works fine!

use Wordpad instead

besides notepad there is still wordpad on many versions of windows which does it correctly.

If a different editor is

If a different editor is used, then I'd suggest to get one that's really suited for source code, e.g. Notepad++
http://notepad-plus.sourceforge.net

Duh..

it only has to do with ansi code of the document as this is asci stuff

notepad++ or wordpad it doesnt matter, there is no preferred tool both can do that.
The only ++ is you dont have to install anything as wordpad is allready installed.

:)

may matter because Windows

may matter because Windows notepad is a bit buggy so as example may break the inline

Sure not often but when does the script become unasable, at least for average users

Thank you : works with 2.6 and Windows now

Thanks to your fix, the "heal selection" feature of Resynthesizer (which still uses textures from top of the image without it) does work *fine* under Windows.

Thank a lot !

Thank to have fixed this script.. Any hope for the other resynthesys script ?

what other resynthesizer scripts broken?

PhotoC, are other resynth scripts broken? As far as I know, the others (Enhance>Smart enlarge, Map>Resynthesizer) are not broken. I am contemplating other scripts built on resynthesizer: 1. Uncrop (see other post this website) 2. a simpler GUI front-end for texture transfer 3. Decay More on 2. The GUI built into Map>Resynthesizer is daunting for new users. It gives full access to the controls for Resynthesizer, but that makes it too hard to learn to do the most common operation, simple texture transfer. More on 3, Decay. If you iterate Resynthesizer on an image without a selection (on the full image) man-made (regularly patterned) stuff slowly disappears. May not be very useful, but interesting, and it might leave artifacts in images. Also interesting because it raises the question whether you can write a plugin that iterates until the user interrupts it. I don't know of any such plugins yet but I know no technical reason why it couldn't be done. I'm thinking you could easily do it in Python using threads. The only outstanding bug I know of is that resynthesizer needs to have its pdb registry fixed (needs recompiling) so that PyGimp plugins can call it. But that is low priority, doesn't affect users. plashless, off banks of noon

other scripts built on resynthesizer:

Did you wrote some of the scripts you described ? I have not clear 1 ( wich other posts on this side ?) but 2 will be very nice to have ,and 3 something interesting to experiment

I've written one

I've written a script that uses resynthesizer, to take the repetition out of a pattern. I tried to upload it, but the silly system thinks it is spam. Here is the sample image: The script is here (I couldn't make it a link or the spam filter seems to block the post...): ffaat.pointclark.net/incoming/scripts/batch-pixelize-indexed.scm -Rob A>

resynthesized pattern

Rob I really need your great script (fill with resynthesized) I tried to get it at faat.pointclark.net/incoming/ but only found the coding and not a .scm file. I am not able to get it to run. do you have a .scm file some where ? I am on mac os btw
appreciate it.

the coding and the scm file

the coding and the scm file are the same thing
I try to explain better if you got to that "code" page with your browser ,IE, firefox oe whatever, you should see, in the browser adress field that the page is called..hem...whater.scm and not whatever.html

so save the page from the browser should save the scm

Even more simple instead then click on the Link, RIGHT click and chose the option "save target as"
In case you may see a option to save as txt...click On that option, that should expand the field were the option is displayed and show the correct one "save as ALL FILES"

this at least in Windows

resynthesized pattern fill

Thanks, was brain dead the other nite. So added resynth_pattern_fill.scm to my scripts file and all looks good but when I run it I get the error: wrong number of parameters expecting 13 only have 11 (as mentioned in other posts). I tired the fix by changing the two lines (plug-in-resynthesizer RUN-NONINTERACTIVE newImage newLayer 0 0 0 newLayer -1 -1 0 0.05) to (plug-in-resynthesizer RUN-NONINTERACTIVE newImage newLayer 0 0 0 newLayer -1 -1 0 0.05 30 200) but no luck Still get error expecting 13 parameters. Any thoughts?

Updated

I've updated the resynth pattern fill script here: http://ffaat.pointclark.net/incoming/scripts/resynth_pattern_fill.scm

It now checks for the number of parameters and provides teh correct amount. I have tested it with the 11 and 13 parameter versions. (BTW I added the 30 and 200 default values and this is working for me).

Try that and see if it works. If so, all the scripts that use resynthesizer could use the same check.

-Rob A>

Working good for me

Thanks for the update, Rob.

Fill with resynthesized pattern

Cool, thanks. Your link is to a different script, but its no big deal, anyone can find the correct script in the same directory. But the one in that directory called resynthesize_pattern_fill.scm seems to have an error in it. It only passes 11 params to resynthesizer, needs 13. At least it doesn't work on my Windows XP, brings up an error message about parameter count. I think thats a good idea, to provide more front ends to resynthesizer. I noticed you did not use the "Tile horizontal and vertical" parameters to resynthesizer. I don't understand what situations they are useful for. Resynthesizer itself is not supposed to add repeating artifacts. My first thought was that your adding noise to the process was not necessary, but I suppose resynthesizer alone would copy the repeating pattern verbatim. plashless, off banks of noon

the 12th and 13th parameters

I think these correspond to the two new parameters that were added to the resynthesize plugin's dialog. I used the default values (30 and 200 in the 'tweaks' pane of the dialog) and the fill-with-resynth script worked and produced convincing results. IOW, in the resynth_fill script, find the TWO lines that look like this (plug-in-resynthesizer RUN-NONINTERACTIVE newImage newLayer 0 0 0 newLayer -1 -1 0 0.05) and add the missing parameters like this (plug-in-resynthesizer RUN-NONINTERACTIVE newImage newLayer 0 0 0 newLayer -1 -1 0 0.05 30 200) HTH

Finally had a chance to

Finally had a chance to review the Script-fu again. Your fix worked. Thanks. :)

Resynthisizer parameters.

My copy of resynthisizer (the latest windows version from the author's web page) only has 11 parameters. To get your script working (heal selection) I had to remove two parameters. What I have figured out with the Tile horizontal and vertical... It only has value if the whole layer is being resynthisized (not a selection). It will then make the image seamless when it runs. It you are using resynthisizer on a selection, the one to set true is the "fit output to bordering pixels". This will make the selection blend with the areas outside the selection. Where did you get your windows binary.. It must be a later version... And thanks for noticing the bad URL. (cut and paste error) It should be ffaat.pointclark.net/incoming/scripts/resynth_pattern_fill.scm -Rob A>

windows versions of resynthesizer

I downloaded Gimp from: gimp.org/windows which leads you to: http://gimp-win.sourceforge.net/stable.html and it includes resynthesizer. The link on Paul Harrison's site (the author of resynthesizer) is: http://www.logarithmic.net/pfh-files/resynthesizer/resynthesizer-for-Win... On the same site, the link to the source is: http://www.logarithmic.net/pfh-files/resynthesizer/resynthesizer-0.16.ta... Just judging by the links, the windows version (0.13?) on Paul Harrison's web site is earlier than the windows version (0.16?) that the Gimp site points to. The Linux resynthesizer (at least with Ubuntu version 8.10) requires 13 parameters. I think there is another person who is maintaining resynthesizer for Debian (and thence to Ubuntu.) My main platform is Ubuntu. Insert standard diatribe about versions and platforms here. plashless, off banks of noon

hmm...

The version on gimp.org/windows definitely does not include Resynthesizer... (GIMP 2.6.6, 32 bits) So I'm wondering where you found a compiled version of Resynthesizer 0.16??

Get errors too.

Thought I had the latest version from Sourceforge Rob. Getting a few errors but it could be due to the version of resynthesizer I'm using. Could you pass on the link to the author's site (maybe it's on Sourceforge too, but got band practice and won't be able to check for 3 hours). :)

More examples

Here are more examples of this script at work. You can see the patterns on the left have significant periodicity, while those on the right have significantly less. -Rob A>

What can I say; fantastic.

Better to commit to smaller selections then larger ones, but still. This one's a keeper. Thanks again Rob. :) Lyle http://www.imageox.com/image/375783-sample.png

Will download and give it a whirl.

Your a top notch guy Rob. Still use your animated brush Script-fu quite often. :) Lyle

Credit to bootchk

I didn't fix the script, the credit goes to bootchk. I just posted up a sample of it working ;) -Rob A>

Whoops; had to link the

Whoops; had to link the Script-fu on another forum I frequent and just noticed. This. Apologies to bootchk. Still, this Script-fu is one of my favorites. :)

screenshots

Do You have some screenshots?

Sample

Here is a result. I quickmasked off the poles and the fire hydrant then ran it with the default radius. No other retouch. -Rob A>

resynthesizer sample not perfect

On close inspection you can see that resynthesizer got the firewall on the roof correct, but that it didn't quite get the middle mullion on the window correct. It fools casual glances though. plashless, off banks of noon

resynth smart remove selection not working

Howdy,

I've downloaded 2.6.8 and have tried resynth and smart remove selection for editing but they are no where near the quality of yours. The resynth leaves big splotchy color and pulls images down from the top.

 

Please help!

Thanks!

Syndicate content