03-02-2024, 09:10 AM
(03-02-2024, 03:35 AM)gimpygirl Wrote: [ -> ]But this function is tje same as "select by color" tool in gimp, right?
Because that is what i want.
Yes...
(03-02-2024, 03:35 AM)gimpygirl Wrote: [ -> ]But this function is tje same as "select by color" tool in gimp, right?
Because that is what i want.
pdb.gimp_image_select_color(image, CHANNEL_OP_REPLACE, image.active_layer, (0, 0, 0))
pdb.gimp-drawable-edit-clear(???)
(03-02-2024, 08:58 PM)Ofnuts Wrote: [ -> ]You Pass a drawable (so, your layer, likely)
For most operations (manual or in scripts), the selection is implicit. The selection applies to the pixels of the current "drawable" that are also included in the selection mask. The only exception to this rule is that for paint/delete operations, if the selection is completely empty, it behaves as if everything was selected. So once you have created a selection, everything you do next is constrained to that selection , until your use pdb.gimp_selection_none(image) to clear the selection.
pdb.gimp_image_select_color(image, CHANNEL_OP_REPLACE, image.active_layer, (0, 0, 0))
pdb.gimp-drawable-edit-clear(image.active_layer)
(03-03-2024, 12:35 AM)Ofnuts Wrote: [ -> ]This is because you used dashes (gimp-drawable-edit-clear) instead of underscores: (gimp_drawable_edit_clear). For Python you are therefore trying to subtract a variable called drawable from pdb.gimp. The Python doc is auto-generated and since the same text is used for script-fu and python-fu, there are things to adapt:
Also, don't use image.active_layer. If you script registration is correct, your script is passed a layer as the second argument and this is the layer you should work with. Using image.active_layer doesn't do you any good because if the active drawable isn't a layer (because it is a mask/channel), then image.active_layer returns None.
- all dashes become underscores
- object IDs in script-fu are plain objects in Python (so you get a gimp.Image object, not an integer)
- when there is no object instead of using the -1 ID you use None
(03-03-2024, 01:42 AM)gimpygirl Wrote: [ -> ](03-03-2024, 12:35 AM)Ofnuts Wrote: [ -> ]This is because you used dashes (gimp-drawable-edit-clear) instead of underscores: (gimp_drawable_edit_clear). For Python you are therefore trying to subtract a variable called drawable from pdb.gimp. The Python doc is auto-generated and since the same text is used for script-fu and python-fu, there are things to adapt:
Also, don't use image.active_layer. If you script registration is correct, your script is passed a layer as the second argument and this is the layer you should work with. Using image.active_layer doesn't do you any good because if the active drawable isn't a layer (because it is a mask/channel), then image.active_layer returns None.
- all dashes become underscores
- object IDs in script-fu are plain objects in Python (so you get a gimp.Image object, not an integer)
- when there is no object instead of using the -1 ID you use None
You really give great answers.
What parameters the method used in 'register' must have? First image, second drawable or are there more options?
How do you know what parameters you must use?
What layer is passed to the drawable parameter by gimp?
Suppouse I open an image with 4 layers. Which one is it? Always the first? And is the first the lowest or highest in the GUI?
This is still very unclear for me: what parameters in the 'register' method you need and what is passed by gimp to them?