Page 1 of 1

Create Contact Sheet Large Recursive Directory

Posted: 2017-11-13T11:19:46-07:00
by tuggleg
Hello Image Magick Community,
I have found several tutorials regarding contact sheets using the

Code: Select all

montage 
command. However, I have not found any that provide instruction on how to create a contact sheet from multiple directories or even a recursive directory. Is anyone aware of how to perform this action?

Thanks!

Re: Create Contact Sheet Large Recursive Directory

Posted: 2017-11-13T11:30:14-07:00
by snibgo
IM won't handle multiple or recursive directories. You would walk through those directories in a shell script, calling montage at each directory.

Re: Create Contact Sheet Large Recursive Directory

Posted: 2017-11-13T13:08:56-07:00
by GeeMack
tuggleg wrote: 2017-11-13T11:19:46-07:00I have found several tutorials regarding contact sheets using the

Code: Select all

montage 
command. However, I have not found any that provide instruction on how to create a contact sheet from multiple directories or even a recursive directory. Is anyone aware of how to perform this action?
Depending on your OS, you should be able to use something like "dir" or "ls" or "forfiles" to generate a list of the images you want to use. Those system commands typically have flags to recurse sub-directories. Redirect the output of those commands to a text file. Then you can run your "montage" command, and where you would normally put the names of the image files you can put the name of that text file list preceded by an "@" sign.

Code: Select all

montage ... @filelist.txt ... output.jpg
ImageMagick will read that text file and run the process as if you entered the list of images directly in your command.

Re: Create Contact Sheet Large Recursive Directory

Posted: 2017-11-13T13:18:16-07:00
by snibgo
In my post above, I was thinking of one montage per directory. But I think GeeMack is correct, that the requirement is for one montage that includes multiple directories, so GeeMack has the solution.

Re: Create Contact Sheet Large Recursive Directory

Posted: 2017-11-13T13:28:07-07:00
by tuggleg
Using PowerShell's 'Get-ChildItem' I have successfully generated a Contact Sheet from multiple directories by doing the following:

Code: Select all

foreach ($dailyPhotoBay in $dailyServerPath)
{
    $dailyImage = Get-ChildItem -Path $dailyPhotoBay -Include *.jpg -Recurse | Where-Object {$_.PSParentPath -like "*Output*"}

    echo $dailyImage
    
    echo $dailyImage.FullName

    montage -verbose -label $dailyImage -font Helvetica -pointsize 50 -background '#FFFFFF' -tile '5x10' -fill 'gray' -define jpeg:size=600x780 -geometry 600x780+40+150 -quality 90  -auto-orient $dailyImage.FullName D:\Contact_Sheet\Sheet.jpg
}