ImageMagick Command Substitution in Windows Shell

How should i convert the following imagemagick command to use in DOS? As far as i understand i can't convert it directly and have to use a for loop in a batch file, but had no success so far.

convert noisy.jpg -crop `convert noisy.jpg -virtual-pixel edge -blur 0x15 -fuzz 15% -trim -format '%wx%h%O' info:` +repage noisy_trimmed_2.jpg


You'd need the for command in order to capture the output of the command to be passed as a parameter. It can be squeezed into one line by saying:

for /f "usebackq delims=" %%info in (`convert noisy.jpg -virtual-pixel edge -blur 0x15 -fuzz 15% -trim -format '%wx%h%O' info:`) do convert noisy.jpg -crop %%info +repage noisy_trimmed_2.jpg

It is best to rename convert.exe to something like imgConvert.exe so it does not conflict with the Windows convert utility. Otherwise you should run it from the directory where the executable exists or specify the path or use an environment variable to get to it.

The vcomp100.dll is required for convert.exe to execute.

DOS does not like single quotes ('). Use double quotes (") where quotes are needed.

Need Your Help

Using shim config with almond

javascript requirejs amd almond

I am trying to shim certain modules for usage with almond like so:

Controlling if a Submit button has been clicked once or more times

php wordpress registration

I have a registration form for groups of people, with 2 Submit buttons: (1) Add a participant, (2) Submit group registration.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.