Post Reply 

Problems with gimp-edit-bucket-fill

Apr 6, 2012, 00:31
Post: #1
Problems with gimp-edit-bucket-fill
Hello, I'm having trouble using script-fu and getting gimp-edit-bucket-fill to work. I tried using this call in a script, but it had no effect. Figured I was doing something wrong with layers or selection, as is often the case. But when I try it in the console, it has no effect. Here's what I tried:

1. Upgraded to the latest gimp version (2.6.12) on Windows (Vista Pro SP2).
2. Closed gimp and restarted it.
3. File > New... and then use all defaults except under advanced I set the fill to BG (white).
4. Filters > Script-fu > Console and then Browse to find gimp-edit-bucket-fill.
5. Enter the following in the console:

> (gimp-edit-bucket-fill 1 0 0 100 10 TRUE 0 0)

1 is the drawable, found by trial and error
0 for FG-BUCKET-FILL (should be black)
100 opacity
10 threshold (0 should work too, but just in case)
TRUE for sample-merged (shouldn't matter because I don't have layers)
o o as x and y coordinates (shouldn't matter because new image is all white)

But nothing happens, my image is still white. I tried a lot of other combinations, never any fill as I expect. Other script-fu console commands modify the image, but not this one. The bucket fill tool in the UI works using the mouse as normal. What am I missing?
Find all posts by this user
Quote this message in a reply
Apr 6, 2012, 06:41
Post: #2
RE: Problems with gimp-edit-bucket-fill
Works for me, in Python, but that's globally the same code:
pdb.gimp_edit_bucket_fill(drawable, FG_BUCKET_FILL, NORMAL_MODE, 100, 0, False, 0,0)

What worries me is your "1 is the drawable, found by trial and error". You could be painting on the wrong drawable. In my code above the drawable is obtained by obtaining the list of images, taking the first, then taking the first layer or that image. In a real script, the drawable is going to be a parameter to your script, filled automatically with the active drawable.

Now answering your questions on
Visit this user's website Find all posts by this user
Quote this message in a reply
Apr 6, 2012, 17:35
Post: #3
RE: Problems with gimp-edit-bucket-fill
You're right, I was getting the wrong drawable. I was just using the first one that didn't give me an error, given that my new image has only [Base Image]. But

> (gimp-image-get-active-drawable 1) ; where 1 is the image, found by trial and error :-)

And then

> (gimp-edit-bucket-fill 2 0 0 100 10 FALSE 1 1)

does work as expected. I swear I'd used gimp-image-get-active-drawable in other attempts, and had the right drawable, but I guess not. In any case, debugging with the script-fu console would be easier if it had built-ins for curImage and curDrawable like a script.

And now I found why the bucket fill wouldn't work in a script: before editing my script (MyBorder.scm), I saved it as MyBorderOriginal.scm. But since it was still in the script folder with .scm extension, gimp was loading both files and the original was overwriting my new one. DOH!

In any case, thanks for your help ofnuts, after 2 days of trying various things, it showed me the right path.
Find all posts by this user
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Late binding / COM for opening an image into GIMP? i73 2 57 Aug 4, 2017 17:39
Last Post: i73
  Loading PythonFu Plugin: ImportError for .../python/ (GIMP 2.8.22/OSX/Py2.7.9) joroek 1 119 Jul 11, 2017 07:26
Last Post: ythgilb
  How to close gimp with batch command? flixe 1 131 Jun 19, 2017 12:29
Last Post: ythgilb
  script-fu ok in gimp, not in commad line dominique 1 260 Sep 28, 2014 03:18
Last Post: dominique
  Trying to write my first GIMP script piotr_kast 1 350 Sep 2, 2014 13:29
Last Post: piotr_kast

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS