Question Details

No question body available.

Tags

gimp python-3.12 python-fu gimp-3

Answers (1)

January 4, 2026 Score: 0 Rep: 4,567 Quality: Low Completeness: 60%

After having spent the night with it, I have found a solution to problem 3 from my original question:

curvesspline() in GIMP 2 needed its coordinate list in the same format as is displayed in the respective UI dialog (Menu -> Colors -> Curves ...). But in GIMP 3 the coordinates obviously must be normalized to 1.0. That is, 0 becomes 0.0, 255 becomes 1.0, and every other value in between must be computed by linear interpolation.

That is, the respective line in my original code must become

... curvesspline(0,
                  [ 0,0,
                    0.42352941176470588235, 0.42352941176470588235,
                    0.75294117647058823529, 0.75294117647058823529,
                    0.86274509803921568627, 0.89019607843137254902,
                    0.87843137254901960784, 1.0 ])

With that change, the images are altered as expected, and the effect is visible.

And here comes a criticism to the GIMP developers. It really sucks that we have to spend our nights and ruin our nerves to find out about such silly changes. They should really put warnings in the documentation about such things. We have all understood that the API structure has changed from GIMP 2 to GIMP 3, and that the Python version has changed as well, and that this means that we need to change to structure of our plug-ins. That is OK.

However, in this context it is absolutely unnecessary to change function parameter lists in the way mentioned above, and to not document it anywhere. Whether a function interprets coordinates as normalized to 1 or as absolute values has absolutely nothing to do with the (documented) changes in the API structure or the new Python version.

Plus, in the respective UI dialog in GIMP 3, the coordinates are still shown as integer values from 0 to 255 as in GIMP 2 (which IMHO is the only method that makes sense). So we have to convert these coordinate values as shown above if we have carefully constructed the optimal curve using the UI dialog and want to use the found values in a script or plug-in. This really sucks, because it is completely unnecessary and documented nowhere.

I also have found the solution to problem 1 from my original question: The correct syntax now is Gimp.HistogramChannel.VALUE (which is documented nowhere of course).

Having said this:

I still have not found any solution to problem 2 from my original question.

I'll make this answer the accepted one, because it shows the solution to the worst of the three problems. But as soon as somebody writes an answer that contains a solution to problem 2, or at least gives an explanation about it, I'll give the credit to that person.