带有Image Magick Montage的Powershell从文本文件读取 [英] Powershell with Image Magick Montage reading from text file

查看:165
本文介绍了带有Image Magick Montage的Powershell从文本文件读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Image Magick的蒙太奇功能来处理PowerShell脚本.我的脚本将一直工作,直到源文件(.jpgs)的数量增加到文件数量不明确为止.一旦太多"文件,由于'Program 'montage.exe' failed to run: The filename or extension is too long',脚本将失败.建议在Image Magick论坛(链接@底部)上从文本文档中读取PowerShell,而不是使用'@'运算符来缩短长度.

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.

代码现在看起来像:

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

我遇到以下错误:

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.

我相当确定使用'@'运算符,因为我可能会混淆脚本,但是我对在PowerShell中使用'@'的理解不足以了解原因.

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.

任何具有ImageMagick理解或仅对PowerShell有更深入理解的人都能解释为什么这可能会破坏脚本吗?

Can anyone with ImageMagick understanding, or simply a stronger PowerShell understanding explain why that may be breaking the script?

我尝试过:

  • 用txt文件中的Get-Content变量替换@E:\Output\contactSheetImages.txt
  • 在不使用'@'运算符的情况下定位文本文档
  • @E:\Output\contactSheetImages.txt周围使用单引号和双引号
  • Replacing @E:\Output\contactSheetImages.txt with a variable to Get-Content from the txt file
  • Targeting the text doc without the '@' operator
  • Using single and double quotes around @E:\Output\contactSheetImages.txt

Image Magick论坛: https://www.imagemagick.org/discourse- server/viewtopic.php?f = 1& t = 34596

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.

这篇关于带有Image Magick Montage的Powershell从文本文件读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆