Page 1 of 1
im_fx_curves.pl
Posted: 2010-10-30T11:14:52-07:00
by imagegem
Hello all
I am battling with the im_fx_curves.pl script provided on the imagemagick site. this is a perl script that allows you to make adjustments similar to photoshop curves:
http://www.imagemagick.org/Usage/script ... _curves.pl
the only modification I have made to the script is changing the path to my perl, I am using macports perl, so the first line of this script is changed to #!/opt/local/bin/perl
I have installed Math::Polynomial from cpan
I am copying an example from inside the script, the example it gives is
./im_fx_curves.pl -p 0,20 100,90 20,80 70,50
When I run this dummy example, I get an error that says
usage: $q = $p->interpolate([$x1, $x2, ...], [$y1, $y2, ...]) at ./im_fx_curves.pl line 55
I do not know how to read perl, but line 55 of the perl script is
my $poly = Math::Polynomial::interpolate( @ARGV );
has anyone been able to get this script to work? Can any of you perl or imagemagick gurus see what I am doing wrong? Has any body got this script to successfully work for themselves?
Re: im_fx_curves.pl
Posted: 2010-10-30T11:37:44-07:00
by Bonzo
You might need something else installed - are there any notes about needing any other software, minimum requirements etc. at the top of the code ?
Re: im_fx_curves.pl
Posted: 2010-10-30T11:47:15-07:00
by imagegem
Nope Bonzo, I see none. My perl script is exactly the same as this one, bar the path to perl
http://www.imagemagick.org/Usage/script ... _curves.pl
Re: im_fx_curves.pl
Posted: 2010-10-30T11:56:46-07:00
by fmw42
I have a bash shell script, curves, that does something like PS. see the link below
Re: im_fx_curves.pl
Posted: 2010-10-30T11:58:36-07:00
by Bonzo
I see "This is a perl version using the Math::Polynomial library"
I pressume you need to install, activate or whatever you do with Perl.
Also in Anthony's other script:
# ASIDE:
#
# Gabe Schaffer created a perl version using the Math::Polynomial library
# (not a standard perl install) in "im_fx_curve.pl"
#
Re: im_fx_curves.pl
Posted: 2010-10-30T12:10:07-07:00
by imagegem
Thank you bonzo and fmw42 for taking the time to help me.
fmw42 I have got that shell script working. I am going to abandon the perl script. I will mess around with it now and hopefully come up with the results i am after.
Thank you once again.
Re: im_fx_curves.pl
Posted: 2010-10-31T18:19:29-07:00
by anthony
imagegem wrote:
I am copying an example from inside the script, the example it gives is
./im_fx_curves.pl -p 0,20 100,90 20,80 70,50
When I run this dummy example, I get an error that says
usage: $q = $p->interpolate([$x1, $x2, ...], [$y1, $y2, ...]) at ./im_fx_curves.pl line 55
I do not know how to read perl, but line 55 of the perl script is
my $poly = Math::Polynomial::interpolate( @ARGV );
I hosted the script in IM Examples. I just copied and pasted your command and it ran perfectly...
Code: Select all
im_fx_curves.pl -p 0,20 100,90 20,80 70,50
7.560*u^3-11.946*u^2+5.087*u+0.200
I have no idea why the Math::Polynomial::interpolate() function is producing a usage message, unless the module has changed since I last installed a personal copy.
I'll update and see if that is the case.
Re: im_fx_curves.pl
Posted: 2010-10-31T18:47:52-07:00
by anthony
yes it looks like the Perl module changed....
This was found in the packages "examples/migration.pl" file...
Math::Polynomial version 1.000 broke backwards compatibility with earlier versions. This example demonstrates how legacy code using Math::Polynomial version 0.04 can be adapted to use a more current version of Math::Polynomial.
Worse still it appears to no longer follow a x1,y1, x2,y2, .... type of input for the points
switching to a [x1,x2,..], [y1,y2,...] input format... Arrggghhhhh.....
It will probably take some study to get the function fixed. Perhaps the original author, Gabe Schaffer, would help.
In the mean time you could try switching to the gnuplot function fitting method in "im_fx_curves"
Re: im_fx_curves.pl
Posted: 2010-10-31T19:12:22-07:00
by anthony
Okay a new version that works has now been uploaded (give it an hour or so to appear)
The old one has been renamed "im_fx_curves_old.pl"
Re: im_fx_curves.pl
Posted: 2010-10-31T22:29:29-07:00
by imagegem
thank you anthony