[英]Imagemagick convert command returning error code 4 when used with PHP
[英]ImageMagick throws error when used with PowerShell
我基本上想取一行文本並將其輸出為.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
}
順便說一句:當您同時將同一問題交叉發布到不同的論壇時,您至少應該將其他論壇的鏈接與您的問題一起發布,以避免有人願意幫助您進行兩次或更多次的工作。
提前致謝;-)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.