Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with writing script that uses Colours->Colourize tool
#1
I've got a xcf file where I've created around 400 paths. I'm using it to change a color of the clothes of audience,
and now I would like to colorize each path with the same color. As far as I understood correctly there is no way to select multiple paths and apply color using Colours->Colourize tool, so I have to do it manually what is very tedious and log process (I need to do it for at leas 10 colors - 400 paths for each of them)..

I went into direction of writing a a script that does a job like Colours->Colourize tool instead

Current script looks like this:

def plugin_main(image, layer):
    for p in image.vectors:
        pdb.gimp_image_select_item(image,CHANNEL_OP_REPLACE,p)
        pdb.gimp_edit_fill(layer, FOREGROUND_FILL) 

it iterates over paths fine but instead of pdb.gimp_edit_fill I need to execute something like  Colours->Colourize  does. 

Is there any way to do it?

thanks in advance Smile ,
Reply
#2
Colourize is one of the GEGL filters, so not currently covered by the "PDB". There are ways to call the GEGL filters, see here.

But in your case a simple solution could be to combine all the paths to which you want to apply the same color. Then you do one selection and use colorize on it.

You can easily merge all the paths for the same color by making them all visible and then using "merge visible paths". But you can also create a new path that contains them based on some other criteria such as the name.

Last, if you know in advance that all these things will have the same color, you don't need to create separate paths for them, you can make several strokes in one path from the start and so directly obtain one path per color (there are scripts to extract a stroke from a path if you change your mind...).
Reply
#3
it seems that merging all the paths does a job for me. Yes, I will always apply the same color. I'm having a football fans that I'm using in my game. I created 400 paths on "generic" png file to change color of the t-shirt depending on the chosen team. One path represents more or less t-shirt of one fan and should be always the same color. You saved me. Thanks a lot! Smile
Reply


Forum Jump: