Here is a short set of IM commands to do the equivalent to my script 
without all the argument prompting and trapping and documentation. 
This is the guts of the script except here I use -function polynomial 
rather than computing a lookup table as in my script.

You can do the computations for the slope and intcp arguments that 
lead up to the convert $infile -function polynomial "$slope,$intcp" 
$outfile any way you can within your Window Batch script. I used some 
unix variables created by using IM -fx calculations. But in my 
original script I used unix bc to do the calcs. Presumably you have 
some way to do those computations to set up slope and intcp arguments.

You can get help from other Window users, such as Bonzo or el_supremo 
on the Discourse forum at 
http://www.imagemagick.org/discourse-server/viewforum.php?f=1 if you 
need help. They are two Windows users that I know about. 
Unfortunately I don't use or know much about Windows scripting as I 
use a Mac.


infile="zelda3.png"
bri=20
con=20
inname=`convert $infile -format "%t" info:`
outfile1=${inname}_b${bri}_c${con}_A.png
diffc=`convert xc: -format "%[fx:100-$con]" info:`
con=`convert xc: -format "%[fx:$diffc<=0.1?99.0:$con]" info:`
arg=`convert xc: -format "%[fx:pi*((($con*$con)/20000) + 
(3*$con/200))/4]" info:`
slope=`convert xc: -format "%[fx:1+atan($arg)]" info:`
slope=`convert xc: -format "%[fx:$slope<0?0:$slope]" info:`
echo "diffc=$diffc; con=$con; arg=$arg; slope=$slope;"
pivot=`convert xc: -format "%[fx:(100-$bri)/200]" info:`
intcpbri=`convert xc: -format "%[fx:$bri/100]" info:`
intcpcon=`convert xc: -format "%[fx:$pivot*(1-$slope)]" info:`
intcp=`convert xc: -format "%[fx:$intcpbri+$intcpcon]" info:`
echo "pivot=$pivot; intcpbri=$intcpbri; intcpcon=$intcpcon; intcp=$intcp;"
convert $infile -function polynomial "$slope,$intcp" $outfile1


See the notes in my script for a discussion of the formulae that I 
used for these calculations and the graphs on my web page at 
http://www.fmwconcepts.com/imagemagick/bcimage/index.php


Regards,

Fred
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to