Photoshop Curves – Type of Curve Used

curves

I'm trying to figure out what kind of curve Photoshop's Curves interface uses. Here are some examples:

enter image description here
enter image description here

I'm trying to recreate the effect using D3.js and SVG. None of the curves available in D3 (cubic basis spline, Catmull-Rom, etc.) fit. I have tried polynomial interpolation, but that tends to introduce unnecessary wiggle into the curve, as evidenced below:

enter image description here

I'm not too fluent in the concepts involved, but I have tried my hand at piecewise polynomial interpolation, which sounded pretty close to that, but with which I still have not had success.

I hope someone with more experience with these concepts, and hopefully with access to Adobe Photoshop or a similar app, can shed some light on the situation 🙂

Here is a sample input-output from the Photoshop curves interface:

enter image description here

Update

Photoshop seems to be using cubic splines, as implemented here.

Note that it differs from what a natural spline is called in D3-shape

enter image description here

Best Answer

The answer seems to be a cubic interpolating spline.

As to how to draw it using Bézier curves (i.e. an algorithm for determining the Bézier control points), I have moved tbat to a separate question.

Related Question