Pat625 wrote:
Serio, i ,copied your post and put it in a translator to see if I could help, but I don't think I can. There are some here who can, and may or not speak Spanish.
Please post in English in this forum.
Welcome to Gimp
________________________________________________________________
: gaah HELP
I am trying to automate the actions to make the pieces of a puzzle with the use of Gimp's puzzle, it is a repetitive task so I ventured for the first time to use the Python console option.
The steps to follow (they are the ones I want to automate), are relatively simple, insert a layer to the original image, in this layer insert the puzzle template, select activate the image, copy visible and paste in a new layer to get the piece .
In the Python console and using the Python procedure browser I have verified the use and application of the procedures with some success, as I am stuck in activating the image or the layers. This can be accomplished with:
Try to use
pdb.gimp_image_set_active_layer (image, active_layer)
without success I don't know what parameter active_layer receives; if I put the name of the layer or the position number it indicates error wrong parameter type
like I wanted to get the position of the layer with
position = pdb.gimp_image_get_item_position (image, item)
without success I don't know what parameter goes in item
If someone can explain to me if any definition is required prior to the procedure?
And what are the parameters or values and how to obtain them
Thanks for your attention
In the Python API, a layer parameter is a gimp.Layer. You get one when you create/obtain the layer, as the return value of the function you called (pdb.gimp_layer_new(), pdb.gimp_image_get_active_layer() or others).
One thing to keep in mind is that the Python PDB documentation is generated automatically from descriptions that are also used for script-fu, while these API work a bit differently. Script-fu identifies everything by a unique ID while the Python API handles
"facade" objects. So where the doc says to use an id, you can pass an object in Python, and when it says you get an ID, you get an object of the adequate class. Wen unknown (as a parameter or as a return result, script-fu uses 0, and python uses None.
Plenty of python script examples
here.