Splitting montage thumbnail output across multiple files (if X images found)

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
l2g
Posts: 3
Joined: 2017-05-14T10:58:37-07:00
Authentication code: 1151

Splitting montage thumbnail output across multiple files (if X images found)

Post by l2g »

This command has done me so much justice; i love it. I was able to thumbnail all of the photos I took with my digital camera over the years with a simple Linux find command merged with this:

Code: Select all

montage -label '%t\n%[width]x%[height]' \
          -size 512x512 '*[240x180]' -auto-orient \
          -geometry +5+5 -tile 5x  -frame 5  -shadow thumb.png &>/dev/null
However... My problem is: some vacations with my camera had me get carried away; I'd take well over 1600+ photos (which i realize isn't that much to an avid photographer), but it appears to be a bit much for montage. All of these images are sitting in one of the directories the command above would process. Although it can appear to generate these insanely gigantic thumbnail files... they're a bit useless and over-sized (and very difficult to reference as a result). These thumbnail files exceed 300MB+ in size even in some cases.

Can montage be tailored to spit out multiple thumbnail/index files if more then say... 200 images were found in the directory it's creating a montage of? Is this possible?

Something like this for example in a case where 500 images were found:
  • thumb01.png (x200 images)
  • thumb02.png (x200 images)
  • thumb03.png (x100 images)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Splitting montage thumbnail output across multiple files (if X images found)

Post by fmw42 »

I think you will have to write a script. You could create lists of groups of 200 and then loop over montage once for each list of files.
l2g
Posts: 3
Joined: 2017-05-14T10:58:37-07:00
Authentication code: 1151

Re: Splitting montage thumbnail output across multiple files (if X images found)

Post by l2g »

Thank you for your fast response; I'll do just as you say and set up a small script to do what i want through small batches.

That said though, i just have one last question: this argument here (in the montage call): *[240x180]

Will it become:
file1 file2 ... file200 [240x180]

Or will it become:
file1[240x180] file2[240x180] ... file200[240x180]

Thanks for all your help!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Splitting montage thumbnail output across multiple files (if X images found)

Post by fmw42 »

It should be the latter. But I would suggest you test on just a few images to be sure it does what you want. Are you trying to resize or crop? That command should resize. That should work with *, but I am not sure it will work with a file list. I suspect it will not unless you have your file list contain image1[...]. image2[...].

However, you can use -resize in the montage command

Code: Select all

montage image1 image2 image3 ... -resize 320x240 .... result.png
l2g
Posts: 3
Joined: 2017-05-14T10:58:37-07:00
Authentication code: 1151

Re: Splitting montage thumbnail output across multiple files (if X images found)

Post by l2g »

The -resize switch greatly helped ease the scripting. I got it working the way i want it now. You can close/lock this thread if you want.

Thank you so much for all of your help!
Post Reply