Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
gimp_drawable_curves_spline control points range.
#1
Hi,

This question came out of the following posts:
http://gimpchat.com/viewtopic.php?f=11&t...70#p280208
http://gimpchat.com/viewtopic.php?f=11&t...70#p280237
http://gimpchat.com/viewtopic.php?f=11&t...70#p280240
http://gimpchat.com/viewtopic.php?f=11&t...70#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.
Reply
#2
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.
Reply
#3
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
Reply
#4
I can confirm that pdb.gimp_drawable_curves_spline() appears to work with either float or integer values.
Reply
#5
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?
Reply


Forum Jump: