Page 1 of 1

Convert not working in a windows batch file

Posted: 2010-10-11T09:20:10-07:00
by Mad-Halfling
Hi, I've got a strange problem and I was wondering if it was a known one, possibly with a solution. I'm using a batch file in windows to do a number of transformations on a couple of images, some of them work but some don't, but they still create the destination file. The odd thing is if I run a line (copied and pasted from the batch file) from the command prompt direct it performs the translation ok. An example is
imconvert -density 450x450 b_trn.gif -black-threshold 100% b_trn_black.png
- I have renamed convert.exe to imconvert.exe to overcome the windows path problem - on this command in the batch file it doesn't convert all the colours (it's a greyscale line graph with a transparent) to black, it only creates the target file. Any ideas?

Thanks

MH

Re: Convert not working in a windows batch file

Posted: 2010-10-11T09:23:41-07:00
by Mad-Halfling
Typical, I've just cracked it - been going at this for 1/2 the day and just noticed something after I posted this (so I thought I'd share the issue, in case anyone else has this problem). In the output from a test batch file the % was missing from the line - windows was trying to treat it like a variable, to anyone else using this in batch files you need to replace % with %% in the batch file, then the transformations work ok

Re: Convert not working in a windows batch file

Posted: 2010-10-11T10:16:12-07:00
by fmw42
Mad-Halfling wrote:Typical, I've just cracked it - been going at this for 1/2 the day and just noticed something after I posted this (so I thought I'd share the issue, in case anyone else has this problem). In the output from a test batch file the % was missing from the line - windows was trying to treat it like a variable, to anyone else using this in batch files you need to replace % with %% in the batch file, then the transformations work ok

see http://www.imagemagick.org/Usage/windows/ for other issues