Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select and bucket fill with python fu
#1
I'm trying to modify a script with the two basic commands: 
1.Select a free selection with a series of points
2.Fill that selection with the foreground at 75% opacity

To do command 1 I use the line:
pdb.gimp_image_select_polygon(image,CHANNEL_OP_REPLACE,3,[width/2.0,height/2.0,x0,y0,x1,y1])

The array at the end is filled with variables I define elsewhere. I try to test this in the python console on a file I've called test.xcf to see how I can expect the syntax to react. The line looks like 

pdb.gimp_image_select_polygon('test.xcf',CHANNEL_OP_REPLACE,3,[640,480,700,600,500,600])

But I get this error :Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: wrong parameter type

What Can I do? I assume I'm calling the image wrong but I'm not sure what to call it
--------------------------------------------------------
For command 2 I'm using:
pdb.gimp_edit_bucket_fill(drawable,BUCKET_FILL_FG,LAYER_MODE_NORMAL_LEGACY,75,0,FALSE,0,0)

I figure I can run this line in the console or in code and it should have the same effect: as long as there's a selection on the page then it'll just fill with the foreground. But when I test the syntax I'm met with:
NameError: name 'drawable' is not defined

So what do I call the selection then? I figure this should be simple but I'm just not sure what words I should use.

Additionally: The modifications I'm making to my script now call numpy in. Will this be an issue if I already have numpy installed on my machine, or do I have to specifically install it onto gimp?
Reply


Messages In This Thread
Select and bucket fill with python fu - by bozjaws - 04-15-2021, 07:31 PM

Forum Jump: