Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

Python rounded rectangle bucket fill problem

Tue Jun 25, 2019 2:45 pm

In Python, I am trying to add to my background image a rounded rectangle and then fill it with green color. My latest attempt is below, which fails on the following line:

pdb.gimp_image_select_round_rectangle(imageobj, 0, Sign1Xoff, Sign1Yoff, Layer1Width, Layer1Height, cornerradius)

Any help / suggestions / recommendations would be appreciated. Thanks in advance!



buffer = 10
cornerradius = 15
Layer1Width = 1500
Layer1Height = 500
Sign1Xoff = 100
Sign1Yoff = 100
SignLayer1 = pdb.gimp_layer_new(imageobj, Layer1Width, Layer1Height, 0, 'SignLayer', 100, 0)
imageobj.add_layer(SignLayer1, 1)
pdb.gimp_layer_set_offsets(SignLayer1, Sign1Xoff, Sign1Yoff)
pdb.gimp_context_set_foreground(GreenColor)
# THE CODE FAILS ON THE NEXT LINE
pdb.gimp_image_select_round_rectangle(imageobj, 0, Sign1Xoff, Sign1Yoff, Layer1Width, Layer1Height, cornerradius)
pdb.gimp_edit_bucket_fill(SignLayer1, 0, 0)

Re: Python rounded rectangle bucket fill problem

Tue Jun 25, 2019 3:59 pm

I think you have missed out the last parameter, try

pdb.gimp_image_select_round_rectangle(imageobj, 0, Sign1Xoff, Sign1Yoff, Layer1Width, Layer1Height, cornerradius, cornerradius)
Post a reply