4x4 Image Montage Generator for Windows DOS

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
PandoraBox
Posts: 23
Joined: 2011-04-10T14:08:11-07:00
Authentication code: 8675308

4x4 Image Montage Generator for Windows DOS

Post by PandoraBox »

New to the forum gotta say "WOW" amazing program and I was having fun with some old dos tricks and I thought I should share this one. (Dunno if this is the right Message Board to post this in please move the Subject should it not be in the right place).

This script as it is will create a dos batch file with a binary concept for making 4x4 image grids (I use it to make masks using this script and scale 2x and I get amazing results)

What you need to build is 2 images 0.png and 1.png (They can be 1 pixel or any size you wish) using this method you literaly make all the possible combo's of every possibility of a 4x4 grid (about 65k in total images)

(Save what is in beetween the dotted line in a file called 4x4_Montage.bat)
@echo off
set A=0
set B=0
set C=0
set D=0
set E=0
set F=0
set G=0
set H=0
Set I=0
Set J=0
Set K=0
Set L=0
Set M=0
Set N=0
Set O=0
Set P=0

:loop
echo montage %P%.png %O%.png %N%.png %M%.png %L%.png %K%.png %J%.png %I%.png %H%.png %G%.png %F%.png %E%.png %D%.png %C%.png %B%.png %A%.png -mode Concatenate -tile 4x4 4x4_%P%%O%%N%%M%%L%%K%%J%%I%%H%%G%%F%%E%%D%%C%%B%%A%.png >>list(4x4).bat
echo %P%%O%%N%%M%%L%%K%%J%%I%%H%%G%%F%%E%%D%%C%%B%%A%

if %A%==1 (goto addB) ELSE set /A A+=1 & goto loop

:addB
set /A A=0 & if %B%==1 (goto addC) ELSE set /A B+=1 & goto loop

:addC
set /A B=0 & if %C%==1 (goto addD) ELSE set /A C+=1 & goto loop

:addD
set /A C=0 & If %D%==1 (goto addE) ELSE set /A D+=1 & goto loop

:addE
set /A D=0 & if %E%==1 (goto addF) ELSE set /A E+=1 & goto loop

:addF
set /A E=0 & if %F%==1 (goto addG) ELSE set /A F+=1 & goto loop

:addG
set /A F=0 & if %G%==1 (goto addH) ELSE set /A G+=1 & goto loop

:addH
set /A G=0 & if %H%==1 (goto addI) ELSE set /A H+=1 & Goto loop

:addI
set /A H=0 & if %I%==1 (goto addJ) ELSE set /A I+=1 & goto loop

:addJ
set /A I=0 & if %J%==1 (goto addK) ELSE set /A J+=1 & goto loop

:addK
set /A J=0 & if %K%==1 (goto addL) ELSE set /A K+=1 & goto loop

:addL
set /A K=0 & if %L%==1 (goto addM) ELSE set /A L+=1 & goto loop

:addM
set /A L=0 & if %M%==1 (goto addN) ELSE Set /A M+=1 & goto loop

:addN
set /A M=0 & if %N%==1 (goto addO) ELSE set /A N+=1 & goto loop

:addO
set /A N=0 & if %O%==1 (goto addP) ELSE set /A O+=1 & goto loop

:addP
set /A O=0 & if %P%==1 (goto EndLoop) ELSE set /A P+=1 & goto loop

:EndLoop
Pause
-----------------

This code works on any NT Version of windows...
Have fun with it .. And have a great day everyone..

P.S: Should anyone can make this in a powershell or figure out to reduce it more (I'd love to make a 16x16 grid generator but 256 variables is just too mind boggling)

Shawn W. D.
aka PandoraBox
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: 4x4 Image Montage Generator for Windows DOS

Post by fmw42 »

Perhaps you could post a link to an example for those of us not on Windows.
PandoraBox
Posts: 23
Joined: 2011-04-10T14:08:11-07:00
Authentication code: 8675308

Re: 4x4 Image Montage Generator for Windows DOS

Post by PandoraBox »

@fmw42

Actually I'll get a page setup with examples on the outputs that can be made but I'll do better than that I'll convert this dos batch file into a BASH script shouldn't be too hard to do... as I know your scripts on your site are all in that format

I'll try and get everything done within the next 24 hours and upload some image examples with the pattern in mind.

What I like about your scripts is that I can convert them to windows format easily to play with as it's pretty much the same type of layouts.

Image 0 is used to start this matrix then by binary pattern it makes all the combinations possible for that grid

[0] [0] [0] [0]
[0] [0] [0] [0]
[0] [0] [0] [0]
[0] [0] [0] [0]

[0] [0] [0] [0]
[0] [0] [0] [0]
[0] [0] [0] [0]
[0] [0] [0] [1]

[0] [0] [0] [0]
[0] [0] [0] [0]
[0] [0] [0] [0]
[0] [0] [1] [0]

[0] [0] [0] [0]
[0] [0] [0] [0]
[0] [0] [0] [0]
[0] [0] [1] [1]

until all patterns end up with Image 1 beeing used

[1] [1] [1] [1]
[1] [1] [1] [1]
[1] [1] [1] [1]
[1] [1] [1] [1]

But I'll create the Bash script so that you can play around with it and make it more versatile for those who don't have windows

Shawn W. D.
Post Reply