I had many issues replicating the generated curve formula example found in the ImageMagick web site on my Windows platform until now.
I’ve finally worked it out and would like to share it with you.
The FX formula from the ImageMagick web site is needed to specify a custom curve adjustment in ImageMagick for a particular channel just like Photoshop. However, the examples on the web site can be rather misleading when you try to replicate it using Windows.
So my question was:
What are the exact steps I need to follow in order to replicate the example from the ImageMagick web site on Windows?
2
Answers
Preliminaries:
I'm currently running Windows 7 and GnuPlot 4.6
Here are the steps.
Install GnuPlot.
Download the fx_control.txt file from http://www.imagemagick.org/Usage/color_mods/fx_control.txt. This file contains the control points. (These are represented by x/y coordinate pairs of 4 special points on the curve graph).
If you need to replicate a curve in Photoshop, you can grab the coordinates from the curves window in Photoshop. Note: When I open the file in NotePad++ the x&y coordinates are on one line, however every set of control points are on a separate line. So if you are wanting to modify the control point in the file I suggest you install and use
notepad++
.Open GnuPlot. Once loaded you will see a command prompt similar to DOS.
Paste the following text behind the
gnuplot>
prompt and hit return:Now paste the following text into Gnuplot and hit return. In this example, I'm assuming you have saved the 'fx_control.txt' file to the root directory on your C: drive.
If you have done everything right, you should have seen a heap of text appear in GnuPlot.
Now paste the following text into Gnuplot and hit return.
GnuPlot has now displayed the curve formula which you use with the ImageMagick FX function. The result matches the example on the ImageMagick website and should be:
To display a plot of this function, copy'n'paste the following line to the
gnuplot>
prompt:You should see something like this:
I hope these steps help you!
By Anthony, the Author of ImageMagick Examples
NOTE: while the final curve shown in the above is correct, only the small segment of the curve between 0.0 and 1.0 (horizontally) and limited to 0.0 to 1.0 (vertically) is used.
To get gnuplot to limit the results of the copy-n-pasted function to those bounds use a command such as…
You can also add the control points to the graph so you can see how well they fit…
Just one small note that should be made clearer.
– Imagemagick uses ‘u’ where gnuplot uses ‘x’ (though that can be changed)
– Imagemagick uses ^ where gnuplot uses ** for mathematical exponentiation (power-of) operation.
keeping this in mind will make converting the gnuplot output to ImageMagick usage much easier.
One final note. You can generally get help on using ImageMagick a lot faster by posting, or searching the ImageMagick Users Forum.