Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create image on nodejs with graphicsmagick

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)

like image 617
Lupus Avatar asked Mar 09 '12 18:03

Lupus


1 Answers

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) {
  // ...
});
like image 139
Linus Thiel Avatar answered Oct 06 '22 14:10

Linus Thiel