我基本上想取一行文本并将其作为.png
文件输出。这个片段本身就可以正常工作:
convert -background lightblue -fill blue -font Candice -pointsize 72 label:Anthony test.png
我有大约 100 行需要处理,所以我尝试使用 PowerShell 通过循环来完成:
$MGLTriggers = Get-Content -Path ".\MGl\MG_Config.txt" -TotalCount 100
foreach ($CurItem in $MGLTriggers){
$Path = Join-Path -Path "./mgl/" -ChildPath ($CurItem + ".png")
convert -background lightblue -fill blue -font Candice -pointsize 72 label:$CurItem $Path}
Convert.exe 为所有项目抛出此错误:
convert.exe: no encode delegate for this image format `LABEL' @ error/constitute.c/WriteImage/1272.
我到处找,拉了相当多的头发。我究竟做错了什么?任何帮助,将不胜感激。
以下代码段在我的环境中运行没有错误:
$ItemList = @(
'John Lennon',
'George Harrison',
'Paul McCartney',
'Ringo Starr'
)
foreach ($Item in $ItemList) {
$Path = Join-Path -Path 'D:\sample\empty' -ChildPath ($Item + '.png')
& "C:\Program Files\ImageMagick-7.1.0-Q16-HDRI\convert.exe" -background "lightblue" -fill "blue" -font "consolas" -pointsize 72 label:"$Item" $Path
}
顺便说一句:当您同时将同一问题交叉发布到不同的论坛时,您至少应该将其他论坛的链接与您的问题一起发布,以避免有人愿意帮助您进行两次或更多次的工作。
提前致谢 ;-)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句