Gimp-Forum.net
gimp_drawable_curves_spline control points range. - 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: gimp_drawable_curves_spline control points range. (/Thread-gimp-drawable-curves-spline-control-points-range)



gimp_drawable_curves_spline control points range. - teapot - 06-11-2023

Hi,

This question came out of the following posts:
http://gimpchat.com/viewtopic.php?f=11&t=20378&start=270#p280208
http://gimpchat.com/viewtopic.php?f=11&t=20378&start=270#p280237
http://gimpchat.com/viewtopic.php?f=11&t=20378&start=270#p280240
http://gimpchat.com/viewtopic.php?f=11&t=20378&start=270#p280246

Does pdb.gimp_drawable_curves_spline want the spline control points to be in the range 0.0 - 1.0, or 0 - 255, or can it cope with either?

As far as I can make out, the deprecated pdb.gimp_curves_spline takes 0 - 255 and calls the C function curves_spline_invoker() that divides each point by 255. The replacement pdb.gimp_drawable_curves_spline calls drawable_curves_spline_invoker() that looks very similar but without the divide.

In summary these both work for me:
pdb.gimp_curves_spline(layer_copy, HISTOGRAM_VALUE, 6, [0, 0, 157, 110, 255, 255])
pdb.gimp_drawable_curves_spline(layer_copy, HISTOGRAM_VALUE, 6, [0.0, 0.0, 0.615, 0.431, 1.0, 1.0])

This doesn't work for me, as it makes the layer all black, but works for David and Issabella:
pdb.gimp_drawable_curves_spline(layer_copy, HISTOGRAM_VALUE, 6, [0, 0, 157, 110, 255, 255])

Should the latter work and why would it work for them and not me?

Many thanks for any help.


RE: gimp_drawable_curves_spline control points range. - Ofnuts - 06-12-2023

My own code (ofn-luminosity-masks) uses  pdb.gimp_drawable_curves_spline() with [0.0 ... 1.0] float values. Some calls are "bi" and accept either a [0.0. ... 1.0] float or a [0 ... 255] integer but I dont know if pdb.gimp_drawable_curves_spline() is among that lot.


RE: gimp_drawable_curves_spline control points range. - nelo - 06-12-2023

Isn't pdb.gimp_curves_spline deprecated?
I think it's the old 2.8 version with Integer values from 0 ... 255

The other one is the 2.10 version with float  values from 0.0 ... 1.0


RE: gimp_drawable_curves_spline control points range. - david - 06-12-2023

I can confirm that pdb.gimp_drawable_curves_spline() appears to work with either float or integer values.


RE: gimp_drawable_curves_spline control points range. - teapot - 06-13-2023

Ofnuts, Thank you that's good to know.

nelo, Thanks, yes gimp_curves_spline is deprecated which is the reason for replacing it with gimp_drawable_curves_spline in the plugin.

david, Thanks, are you also david on gimpchat?