Re: ImageMagick's convert's equivalent to (gimp-brightness-contrast)

Shlomi Fish <[email protected]>
Newsgroups gmane.comp.video.image-magick.user
Message-ID <[email protected]>
On Wednesday 06 Jan 2010 04:34:03 Fred Weinhaus wrote:
> 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.
> 

Thanks, I've taken a look and it looks fine.

> 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.

Yes.

> 
> 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.

Well, I'm using Mandriva Linux Cooker, but I have to prepare this script for 
Windows. But I can take it from here. Maybe I'll use something like Lua or GNU 
Awk for that.

> 
> 
> 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

OK.

Regards,

	Shlomi Fish

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

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
"Humanity" - Parody of Modern Life - http://shlom.in/humanity

Bzr is slower than Subversion in combination with Sourceforge. 
( By: http://dazjorz.com/ )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.