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.