Page 1 of 1

Curve in Photoshop

Posted: 2019-08-29T22:00:56-07:00
by alidayvn
Hey Guys, i try to simulate the curve in photoshop by using MagicWand.
I tried MagickFunctionImageChannel, it works well when i only has two arguments, as below:

double d[4];
d[0] = 0.0; d[1] = 0.0; d[2] = 1.0; d[3] = 0.5;
status = MagickFunctionImageChannel(magick_wand_local,RedChannel,PolynomialFunction,4,d);

but when i try to add another control point to the function, it just messed up, i cant figure out any clue to connect the value in PS curve
to MagickFunctionImageChannel.

Any idea?

Re: Curve in Photoshop

Posted: 2019-08-30T20:39:47-07:00
by fmw42
The polynomial function uses coefficients not control points, I believe. The d values are coefficients of a polynomial, not control points. Sorry, I do not know the MagickWand API and just use the command line.

See https://imagemagick.org/Usage/transform ... polynomial


To emulate a smooth curve, you need to develop software to create a splined lookup table from control points. I have a bash unix shell script that does that called, curves, at my link below. My script does not work in Windows.

Re: Curve in Photoshop

Posted: 2019-08-31T06:33:12-07:00
by snibgo
From a number of control points, software can calculate coefficients for a polynomial that passes through those points. But this is usually not a good idea, because the resulting curve is often too extreme.

Instead, we often use a spline to pass through the control points. Gnuplot can do that job. However, there are different criteria and methods for generating splines, and Photoshop's curve is likely to be different to the curve from other software.