Which filter corresponds to the Tone Curve module in GIMP?

I’m looking for the GIMP or Gegl filter that corresponds to the Tone Curve of GIMP. The “gegl:contrast-curve” filter seems similar to the Tone Curve, but it only adjusts grayscale images, whereas the Tone Curve is applicable to color images or each color channel.

There is also a “gimp:curves” filter, but there is no information about it. Which filter corresponds to the Tone Curve module in GIMP?

I am not sure if I am missing something here, but why not just use the curves option in GIMP. Why does it have to be a ‘filter’?

Because I try to use it from Python script. Gimp.Drawable.curve_spline() can apply tone curve to the image, but it changes pixel values destructively. I am looking for the way to apply tone curve non-destructively from Python script.

1 Like

Unfortunately it seems 3.x has a problem with splines:

1 Like

Thank you for the information. In my trial, it appears to be operating normally. I suppose that it may operate abnormally if the amount of input data is small.

Interesting! Would you share your code that demonstrates the spline API working as it should?

Here is a sample program of applying gamma correction using Gimp.Drawable.curves_spline.

Thanks for that test code. I think I might understand why we’re getting different results. You’re adjusting just the midtones (gamma), while I’m trying to generate a complete curve.

I think the problem of the issue reporter is that he tries to input 0-255 range integer data to curves_spline() method. I suppose that it can only accept now 0.0 - 1.0 range float data.

Yes! Thank you. I solved my issue by manually creating the curve I want, then opening the GimpCurvesConfig.settings file, copying the points numbers, pasting them into the code, and it works. You’ve made my day brighter.