Batch file problems on XP with conert and composite

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
peterpan33

Batch file problems on XP with conert and composite

Post by peterpan33 »

Hello hello,
i have a problem with a batch file. I want to convert and composite pictures from my directory with the batch file. So all pics are composite with the 123.gif! On WIN7 everything is fine, but on Win XP it is a problem and it does´n work. The code is:

Code: Select all

SET "TEST=C:\TEST\123.gif"
FOR /f "delims=" %%I IN ('DIR *.JPG /b') DO (convert "%TEST%" ^( "%%I" -resize 1170x878 ^) -geometry +610+115 -composite newpic\%date%_"%mytime%"_"%%I")
And does some knows why the image 123.gif can not be a 123.jpg? If it is a JPG the result pics will be dark.
Sorry for my englisch and thanks for help.
Peter
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Batch file problems on XP with conert and composite

Post by snibgo »

Windows XP doesn't like filenames with slash (/). %date% probably contains slashes.

The quotes in SET "TEST=C:\TEST\123.gif" don't make sense (but they seem harmless).

FOR /f "delims=" %%I IN ('DIR *.JPG /b')
could be
FOR %%I IN (*.JPG)

I don't know why 123.jpg might be a problem. What version IM do you use? Please post 123.gif, 123.jpg and one of the jpg files that creates the problem.
snibgo's IM pages: im.snibgo.com
peterpan33

Re: Batch file problems on XP with conert and composite

Post by peterpan33 »

Hello,
thanks for your fast help. My %date% isn´t with a slash. It is like: 28.05.2010.
I will try my file without the quotes in set...
Could it be that the quotes in:

Code: Select all

FOR /f "delims=" %%I IN ('DIR *.JPG /b') DO (convert "%TEST%" ^( "%%I" -resize 1170x878 ^) -geometry +610+115 -composite newpic\%date%_"%mytime%"_"%%I")
make problems. I made the quotes to convert/composite pics with a blank or a not regular sign like $%& in the filename.
I use ImageMagick-6.6.1-4-Q8-windows-dll on my computer. I will check my files!!!
Thanks
Peter
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Batch file problems on XP with conert and composite

Post by snibgo »

You shouldn't need quotes inside filenames, so
newpic\%date%_"%mytime%"_"%%I"
should be:
"newpic\%date%_%mytime%_%%I"


Start simple, and build up until it doesn't work, to isolate the problem, such as:

convert C:\TEST\123.gif ( abc.JPG -resize 1170x878 ) -geometry +610+115 -composite newpic\28.05.2010_10.34.12_abc.JPG
snibgo's IM pages: im.snibgo.com
Post Reply