Solved Problems with DOS scripting

November 17, 2011 at 08:40:59
Specs: Windows XP
Dear friends,

Is it possible to make overlaying of video files by ImageMagic software?

I used VirtualDub software to make two sequenses of .bmp pictures and placed the files together into common folder.
Background images have name: base_0000.bmp, base_0001.bmp, etc. Overlay images have names: L_0000.bmp, L_0001.bmp, etc.

I have written the text for a batch file of DOS:

Code:
@echo off
echo Hello this is a batch file for overlaying a small picture to a large picture
mkdir over
FOR %%a in (L_*.bmp) DO (
ECHO Processing file: "%%~nxa"
composite -compose Copy -geometry +31+202 %%a base_*.bmp over\over_%%a
)
PAUSE

But it does not work properly as I need. It takes the file base_0000.bmp always for all files L_*.bmp but I need
each file "base_" for other file "L_". Is it possible somehow?

I have used ImageMagick 6.7.0-0 Q16 (2011-06-01) OS: Win XP Sp2

Thanks in advance!

Vladimir Klimov


I have posted the problem into ImageMagic forums and have received the answer:


This appears to be more of a Dos scripting problem rather than a ImageMagick problem.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/

But the answer is not so nice for me...


See More: Problems with DOS scripting

Report •

#1
November 17, 2011 at 09:52:01
✔ Best Answer
I roughly know ImageMagic so I hope the following may fit your need; replace the posted for loop with

setlocal EnableDelayedExpansion
for %%a in (L_*.bmp) do (
  set file=%%~na
  set file=!file:L_=!  
  echo.  Processing file: "%%~nxa"
  composite -compose Copy -geometry +31+202 %%a base_!file!.bmp over\over_%%a
)

Be aware this is NT batch since there is no DOS under XP as it is a NT kernel system.

Report •

#2
November 19, 2011 at 04:15:21
Thank you very much for your help!

There is a small mistake in your text. It was necessary to modify the code a little:

@echo off
echo Hello this is a batch file for overlaying a small picture to a large picture
mkdir over
setlocal EnableDelayedExpansion
for %%a in (L_*.bmp) do (
set file=%%~nxa
set file=!file:L_=!
echo. Processing file: "%%~nxa"
composite -compose Copy -geometry +31+202 %%a base_*!file!.bmp over\over_%%a
)

Background images must have the prefix "base_" in the beginning their name, but overlay images must be "L_" exactly.

Nevertheless, it works good!

Usually, I use Avisynth 2.56 software (through VirtualDub 1.8.8) but the overlay function is bad in the Avisynth. What is the matter.
Now the obstacle is busted!

Thank you!


Report •
Related Solutions


Ask Question