[magick-users] Autolevel Correction
Wolfgang Hugemann
auto at hugemann.de
Wed Apr 15 13:18:15 PDT 2009
> >Or is there
> >any chance that I can get the result of the "identify" statement into
> >just one "convert" command, so that I could do the above transformation
> >in a simple batch file, instead of having to deal with a tedious VBS?
>
>
> Not sure what you mean here. But there has been some improvements on
> Anthony's Windows notes. See
> http://www.imagemagick.org/Usage/api/#windows
Yes, that's a good hint. To do the gamma correction in a single line DOS batch file, you have to write
FOR /F %%x IN ('identify -format "%%[fx:log(mean)/log(0.5)]" %1') Do imconv %1 -gamma %%x %1.jpg
(Imconv.exe is my version of convert.exe.)
%1 is the argument of the batch file, i.e. the filename, e.g. test.jpg. The result of the above batch processing will then be named test.jpg.jpg.
The best explanation of the newer options to the FOR command can be found at
http://www.computerhope.com/forhlp.htm
This is also the best source for any DOS command, AFAIK.
So far, I did all of the more complex processing in Visual Basic Script (VBS), which once was intended as the DOS batch file substitute and is interpreted by the Windows Script Host, which is installed on any Windows machine. I could supply some VB-Scripts to demonstrate how this works.
Thanks
Wolfgang
More information about the Magick-users
mailing list