Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script syntax for IMAGE or DRAWABLE
#1
Hello!

I've searched for hours for an answer on the net and I haven't found anything, although I'm sure my question is very simple, as I'm a beginner with script-fu. I've been working on GIMP for years, but I've never used the console.

Here's my question: on the console, I want to use the procedure:

gimp-drawable-hue-saturation

which I've chosen from the list. When I activate this procedure, I have to fill in the necessary data for

(gimp-drawable-hue-saturation drawable hue-range hue-offset lightness saturation overlap)

So I've entered my chosen values:
(gimp-drawable-hue-saturation drawable 0 0 0 -100 0)

But what do I do with DRAWABLE????

My layer is named "Calque", so I've tried the "Calque" syntax, and other possibilities, but I keep getting an error message, see the attached screenshot.

Thank you SO MUCH for your help!
Sylvie


Attached Files Thumbnail(s)
   
Reply
#2
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:
  • 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
Now, if you work in the console, there is no script, so you don't get these set up automatically. The image ID is displayed in the title bar so you can use that integer value directly (in Script-fu, in Python is a bit different)).

   

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.
Reply
#3
Thank you very much, Ofnuts, I'll try this.
Reply


Forum Jump: