最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - create image on nodejs with graphicsmagick - Stack Overflow

programmeradmin3浏览0评论

I need a way to create an image on graphicsMagick via node.js

Normally I can manage this with;

gm convert -background transparent -pointsize 30 -gravity Center label:türkçee HEEEEEY.png

I need the equivalent of this input in node.js like;

var gm = require('gm');
gm.background('transparent')
  .gravity('Center')
  .fontSize(30)
  .drawText('Test')
  .write('HEEEY.png')

PS: I don't want to give image size as parameter. (sorry for my english)

I need a way to create an image on graphicsMagick via node.js

Normally I can manage this with;

gm convert -background transparent -pointsize 30 -gravity Center label:türkçee HEEEEEY.png

I need the equivalent of this input in node.js like;

var gm = require('gm');
gm.background('transparent')
  .gravity('Center')
  .fontSize(30)
  .drawText('Test')
  .write('HEEEY.png')

PS: I don't want to give image size as parameter. (sorry for my english)

Share Improve this question asked Mar 9, 2012 at 18:51 LupusLupus 1,5183 gold badges21 silver badges39 bronze badges 3
  • This is just a google away. aheckmann.github./gm – Linus Thiel Commented Mar 9, 2012 at 19:03
  • I know that. It manuplates an image not creating a new one it. – Lupus Commented Mar 9, 2012 at 19:05
  • i didnt fount a way to create a new one. – Lupus Commented Mar 9, 2012 at 19:07
Add a ment  | 

1 Answer 1

Reset to default 11

Look in the node-grapicksmagick README, under "creating an image".

// creating an image
gm(200, 400, "#ddff99f3")
.drawText(10, 50, "from scratch")
.write("/path/to/brandNewImg.jpg", function (err) {
  // ...
});
发布评论

评论列表(0)

  1. 暂无评论