编写图像时nodejs gm错误

时间:2013-12-19 10:41:28

标签: node.js graphicsmagick

我正在尝试从node.js gm项目运行示例来创建图像(new.js)。我安装了Windows 7和GraphicsMagick-1.3.18-Q8。

代码:

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"' 
}

感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

Windows 10。

我认为ghostscript并不是必需的,因为它在Windows上不包含这种字体,但字体可以在github.com/fontforge中找到并放在工作目录中。

相关问题