Page 1 of 1

[SOLVED] Combining two sets of images into third set

Posted: 2014-02-09T10:23:55-07:00
by RyanBram
Let's say, I have two sets of images, in two different folder (directory)
First directory contains:
A.png ; B.png; C.png

Second directory contains:
1.png ; 2.png; 3.png

How to combine (composite) those two into third set and become:
A1.png; A2.png; A3.png;
B1.png; B2.png; B3.png;
C1.png; C2.png; C3.png;

I already read http://www.imagemagick.org/Usage/files/ and try something like

Code: Select all

for %a in *.* do
, but still cannot find (or not aware) the correct method.

Regards.

Re: Combining two sets of images into third set

Posted: 2014-02-09T10:29:16-07:00
by snibgo
In a Windows BAT script:

Code: Select all

for %%a in (dir1\*.png) do (
  for %%b in (dir2\*.png) do (
    convert %%a %%b {something} %%a_%%b_out.png
  )
)

Re: Combining two sets of images into third set

Posted: 2014-02-09T11:00:29-07:00
by RyanBram

Code: Select all

for %%a in ("%~d0%~p0Original\*.*") do ( for %%b in ("%~d0%~p0Mask\*.png") do ( "%~d0%~p0bin\imagemagick\convert" "%%a" ( "%%b" -negate ) -alpha off -compose copy-opacity -composite "%~d0%~p0Result\%%~na%%~nb.png" ) )
That's my script. But the result is only the console who appear and disappear immediately without I noticed what message it tries to tell.

Something wrong with my script?

Re: Combining two sets of images into third set

Posted: 2014-02-09T11:08:24-07:00
by snibgo
It's hard to say without peering over your shoulder, but you probably need to escape the parentheses:

Code: Select all

^( "%%b" -negate ^)

Re: Combining two sets of images into third set

Posted: 2014-02-09T11:13:44-07:00
by RyanBram
It works. Thank you very much, Snibgo.

Problem Solved. (I don't know how to mark problem as solved)

Re: Combining two sets of images into third set

Posted: 2014-02-09T11:58:00-07:00
by fmw42
RyanBram wrote:It works. Thank you very much, Snibgo.

Problem Solved. (I don't know how to mark problem as solved)
Edit the title of your very first post on this topic