Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with correct colours in python script
#2
(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 ?
Reply


Messages In This Thread
RE: Problem with correct colours in python script - by programmer_ceds - 12-06-2021, 05:03 PM

Forum Jump: