I am trying to build a PowerShell script that will pull jpgs from particular directories recursively and run them through ImageMagick montage
to create a Contact Sheet with the filenames as the labels. As of now, my $filename
code is broken, as it only provides the last file's name and labels for all the images with the same filename.
Currently I have:
foreach ($dailyPhotoBay in $dailyServerPath)
{
$dailyImage = Get-ChildItem -Path $dailyPhotoBay -Include *.jpg -Recurse | Where-Object {$_.PSParentPath -like "*Output*"}
foreach ($image in $dailyImage)
{
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($dailyImage)
}
echo $fileName
montage -verbose -label $fileName -pointsize 20 -background '#FFFFFF' -tile '5x40' -fill 'black' -define jpeg:size=600x780 -geometry 600x780+40+150 -quality 90 -auto-orient $dailyImage.FullName D:\Contact_Sheet\Sheet.jpg
}
With this code all images are pulled and the contact sheet looks correct, except all the images are labeled the same - the name of the very last image.
As always, any help is appreciated.
Thanks!