I am working on a PowerShell script using Image Magick's montage function. My script works until the source files (.jpgs) volume increases to an ambiguous number of files. Once there are 'too many' files, the script fails due to 'Program 'montage.exe' failed to run: The filename or extension is too long'
. It was suggested on the Image Magick forum (link @ bottom) to have PowerShell read from a text doc instead to reduce the length using the '@' operator.
The code now looks like:
montage -verbose -label %t -pointsize 25 -background '#FFFFFF' -tile 24x5 -fill 'black' -define jpeg:size=600x780 -geometry 600x780+40+150 -quality 90 -auto-orient @E:\Output\contactSheetImages.txt E:\Contact_Sheet.jpg
I am getting the following errors:
montage : montage.exe: unable to open image '@E:ÿþE': No such file or directory @ error/blob.c/OpenBlob/2695.
montage.exe: no decode delegate for this image format `' @ error/constitute.c/ReadImage/508.
montage.exe: `E:\Contact_Sheet.jpg' @ error/montage.c/MontageImageCommand/1774.
I am fairly certain using the '@' operator as I have may be confusing the script, but I don't have enough understanding of using '@' in PowerShell to know why.
Can anyone with ImageMagick understanding, or simply a stronger PowerShell understanding explain why that may be breaking the script?
I have tried:
@E:\Output\contactSheetImages.txt
with a variable to Get-Content
from the txt file@E:\Output\contactSheetImages.txt
Image Magick Forum: https://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=34596
Thanks everyone for your ideas and help. While I wasn't able to use any of the provided ideas it allowed me to think up a simple solution.
I simply removed the need to read a text file by targeting the files directly:
montage -verbose -label %t -pointsize 25 -background '#FFFFFF' -tile 24x5 -fill 'black' -define jpeg:size=600x780 -geometry 600x780+40+150 -quality 90 -auto-orient E:\Output\*.jpg E:\Contact_Sheet.jpg
Although I would have liked to solve the problem instead of developing a work around, my script is now working.