Page 1 of 1

Montage of Combinations and Permutations of .jpg

Posted: 2017-04-06T08:27:17-07:00
by Cardmaker
Hello! I´m absolutely new in ImageMagick. Looking for a -montage solution with twenty two images.
I want get an ouput of 9240 (!) combinations of twenty-two different images without repetition, ordered in 9240 images in a tile 1x3

Permutations without repetition (n=22, r=3) Using Items:
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22

List has 9240 entries.
[1,2,3],[1,2,4],[1,2,5],[1,2,6],[1,2,7],[1,2,8],[1,2,9],[1,2,10],[1,2,11],[1,2,1
2],[1,2,13],[1,2,14],[1,2,15],[1,2,16],[1,2,17],[1,2,18],[1,2,19],[1,2,20],[1,2,
21] [...]

I have no clue how to do this. Some hints? Thank you!

Re: Montage of Combinations and Permutations of .jpg

Posted: 2017-04-06T08:37:58-07:00
by snibgo
I would do it like this:

1. Work out what montage command does what you want from three input files.

2. Write a script with three nested loops. The first loops from 1 to 20, the second from the first plus 1 to 21, the third loops from the second plus 1 to 22.

3. Within the third loop, call the montage with the required three filenames.

Obviously, the details will depend on the version of IM you use and your script language.

Re: Montage of Combinations and Permutations of .jpg

Posted: 2017-04-06T08:45:26-07:00
by Cardmaker
Thank you! :) A very good hint.

Re: Montage of Combinations and Permutations of .jpg

Posted: 2017-04-06T10:38:54-07:00
by fmw42
I have moved this post to the Users forum, since it seems directly related to IM commands

Re: Montage of Combinations and Permutations of .jpg

Posted: 2017-04-07T07:47:04-07:00
by Cardmaker
Done!
I just write this line 9240 times, one for a permutation

magick montage -background #FF0000 01.jpg 02.jpg 03.jpg -mode Concatenate -tile x1 montage#.jpg

Thanks for the help!