12-06-2021, 05:03 PM
(12-06-2021, 04:16 PM)david Wrote: I have created a small script which fills a transparent layer with a colour. If I carry out the procedure manually I get the correct colour, but when I do it in Python the colour is incorrect. The example detailed below the colour is D37518 Hex - 211, 117, 24 Decimal.
The relevant piece of the code is:
Tone = pdb.gimp_layer_new(image, width, height, type, "Tone", opacity, mode) #new empty layer
image.add_layer(Tone, 0)
if colour == 0:
sepia = gimpcolor.RGB(211,66,20)
pdb.gimp_context_set_foreground(sepia)
pdb.gimp_drawable_edit_fill(Tone, FILL_FOREGROUND)
If I run the code then check the inserted colour with the eyedropper I get the result in the screenshot.
No doubt something silly I am doing!
So what sets the foreground colour if colour != 0 ?