Gimp-Forum.net
Help! Wrong number of parameters - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions)
+---- Thread: Help! Wrong number of parameters (/Thread-Help-Wrong-number-of-parameters)



Help! Wrong number of parameters - david - 08-31-2020

I am trying to modify a channel using gimp_drawable_curves_spline. The line I am using is:

pdb.gimp_drawable_curves_spline(image,HISTOGRAM_VALUE,18,0.0,0.0,0.0625,0.125,0.125,0.250,0.250,0.375,0.5,0.5,0.75,0.625,0.875,0.750,0.9375,0.875,1.0,1.0)

It gives me an error of wrong number of parameters. Obviously something silly on my part, but I have checked my decimal points, counted my commas numerous times and still can't see what I am doing wrong!

Any help much appreciated.
david.


RE: Help! Wrong number of parameters - Ofnuts - 08-31-2020

The fourth argument is an array, and instead your provide the number as individual arguments. Do something like:
Code:
splinePoints=[0.0,0.0,0.0625,0.125,0.125,0.250,0.250,0.375,0.5,0.5,0.75,0.625,0.875,0.750,0.9375,0.875,1.0,1.0]
pdb.gimp_drawable_curves_spline(image,HISTOGRAM_VALUE,len(splinePoints),splinePoints)



RE: Help! Wrong number of parameters - david - 08-31-2020

Ofnuts,
Many thanks for your reply
I copied the lines into my program, but when I try to run it I get an error. The message in the terminal is "TypeError: wrong parameter type".
I have struggled with this for many hours! Unfortunately searching the net has failed to find examples to follow.
david.


RE: Help! Wrong number of parameters - Ofnuts - 08-31-2020

The first parameter is a "drawable", that is, a layer, layer mask, or channel. If "Image" is an image, it is not the right thing to pass.

I have done something similar (with that same API) in my ofn-luminosity-masks script that you'll find here (the script itself is discussed here)


RE: Help! Wrong number of parameters - david - 08-31-2020

Ofnuts,

Many thanks - problem solved!!!
I don't know what us gimpers would do without the help from you and Rich!!!

david.