04-09-2024, 07:47 AM
image and drawable are variables, that, technically in script-fu, are integers with the ID(*) of the image of "drawable" (layer/mask/channel) that you are working with. The value comes either from:
Not such direct way to access the layer, but you can retrieve the id of the active drawable/layer with (gimp-image-get-active-layer image) or (gimp-image-get-active-drawable image), or use (gimp-image-get-layer-by-name image name) to retrieve it by name (with the caveat that the name may not always be what you expect)(**).
(*) it is a gimp-wide identifier, and is not for instance the position of the layer in the stack. In general you don't need to know the actual value, you just pass it around unchanged. Checking the ID is useful only when things don't happen on the right layer so you can make sure you aren't mixing up things in the code.
(**) these calls are fine in the console, but it you write a script, using the script arguments is a much better way.
- an argument to your script: if you register the script properly (first two arguments are usually an image and a drawable), the active image and drawable/layer is passed to the script as an argument
- the result of some function you called: for instance gimp-layer-new-from-visible returns the ID of the created layer
Not such direct way to access the layer, but you can retrieve the id of the active drawable/layer with (gimp-image-get-active-layer image) or (gimp-image-get-active-drawable image), or use (gimp-image-get-layer-by-name image name) to retrieve it by name (with the caveat that the name may not always be what you expect)(**).
(*) it is a gimp-wide identifier, and is not for instance the position of the layer in the stack. In general you don't need to know the actual value, you just pass it around unchanged. Checking the ID is useful only when things don't happen on the right layer so you can make sure you aren't mixing up things in the code.
(**) these calls are fine in the console, but it you write a script, using the script arguments is a much better way.