Page 1 of 1

have prefix in output file name

Posted: 2009-04-28T22:28:00-07:00
by edjayks
I tried to convert a number of files like this:
convert -size 660x580 -depth 8 "C:\path...\*.jpg" "C:\path...\%d.png"

path... is the path to the file location.

For example, there's 2 file, 1.jpg and 2.jpg,
after conversion, the file would be named d-1.png and d-2.png.

Why is "d-" added to the file name? How do i remove or prevent it?

Thanks.

*additional info: this problem only happen when the command is in a windows batch file. If i type in the command manually into command prompt, i could get 1.png and 2.png as the output file name.

Re: have prefix in output file name

Posted: 2009-04-29T09:04:16-07:00
by el_supremo
this problem only happen when the command is in a windows batch file
That suggests that the problem is in the interpretation of the percent sign. I think in a batch file you have to double the percent.
Try this sort of thing:

Code: Select all

convert -size 660x580 -depth 8 "C:\path...\*.jpg" "C:\path...\%%d.png"
Pete

Re: have prefix in output file name

Posted: 2009-04-30T01:29:59-07:00
by edjayks
Hi el-supremo, thanks for the help. It works fine after doubling the percent.
Thanks.

Re: have prefix in output file name

Posted: 2009-04-30T18:34:51-07:00
by anthony
For more information about using IM under Windows Batch files, see
Im Exmaples, APIs, Windows
http://www.imagemagick.org/Usage/api/#windows

Special thinks to Wolfgang Hugemann for his re-write of this section of IM examples.