Montage by file name order?

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
Cutless
Posts: 2
Joined: 2012-06-21T11:12:28-07:00
Authentication code: 13

Montage by file name order?

Post by Cutless »

I have 649 images that I wish to tile together by their number in a 11x x 59y order. All the images are by a pattern digits (like 1.png, 2.png, 3.png > 647.png, 648.png, 649.png )

I've been trying to fiddle with the options to make them tile in some form of order but learnt that it tiles by column. (I'm using Windows OS Terminal if this makes any difference.)

I was hoping someone could help me sort this out.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage by file name order?

Post by fmw42 »

I think you may need to make your image names have leading zeros, such as 001.png .... 999.png so that they are properly alphabetized in your file system. Many systems list 10 after 1.
Cutless
Posts: 2
Joined: 2012-06-21T11:12:28-07:00
Authentication code: 13

Re: Montage by file name order?

Post by Cutless »

Thank you this worked.

I had to make a macro to replace 99 images (good thing I have a g510 keyboard) to add the zeros for me.

I then used the output

Code: Select all

montage -tile 11x59 *.png output.png
To those who may also have the same issue.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Montage by file name order?

Post by anthony »

Their are a couple of ways.
These are detailed in IM Examples, File Handling, Reading Images

Solutions...

convert image_[0-9].gif image_[1-9][0-9].gif animation.gif
convert image_?.gif image_??.gif image_???.gif animation.gif
convert image_(?|??|???|????).gif animation.gif
convert 'image_%d.gif[0-123]' animation.gif

the later works especially well, and you can specify the format of the digits, but will stop on the first 'missing' image encountered.

NOTE: IM itself will expand the meta-characters '~' '*' and '?' if these are quoted to prevent the shell expanding them. BUt it does not understand the BASH shell '{...}' or '(...)' meta-characters, and '[...]' is used for read modifiers rather than character set expansion.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply