0
我試圖運行node.js gm項目中的例子來創建一個圖像(new.js)。我安裝了Windows 7和GraphicsMagick-1.3.18-Q8。nodejs gm寫入圖像時出錯
代碼:
var fs = require('fs'),
gm = require('gm'),
dir = __dirname + '/imgs';
gm(525, 110, "#00ff55aa")
.fontSize(68)
.stroke("#efe", 2)
.fill("#555")
.drawText(20, 72, "graphics")
.fill("#fa0")
.drawText(274, 72, " magick")
.write(dir + '/new.png', function(err){
if (err) return console.dir(arguments)
console.log(this.outname + ' created :: ' + arguments[3])
}
)
錯誤:
{
'0': { [Error: Command failed: gm convert: Unable to read font (n019003l.pfb) [Nosuch file or directory].] code: 1, signal: null },
'1': '',
'2': 'gm convert: Unable to read font (n019003l.pfb) [No such file or directory].\r\n',
'3': 'gm "convert" "-size" "525x110" "xc:#00ff55aa" "-pointsize" "68" "-strokewidth" "2" "-stroke" "#efe" "-fill" "#555" "-draw" "text 20,72 \\"graphics\\"" "-fill" "#fa0" "-draw" "text 274,72 \\"magick\\"" "C:\\Users\\Owner\\Practice\\youtube/imgs/new.png"'
}
任何幫助表示讚賞。
我讀過的答案說,要安裝Ghostscript,我做了但沒有變化 – iona1
我有這個問題。我不得不安裝ghostscript,然後用brew重新安裝graphicsmagick,問題就消失了。 – forrestranger