have prefix in output file name

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
edjayks

have prefix in output file name

Post 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.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: have prefix in output file name

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
edjayks

Re: have prefix in output file name

Post by edjayks »

Hi el-supremo, thanks for the help. It works fine after doubling the percent.
Thanks.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: have prefix in output file name

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply