5

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)

Lupus
  • 1,519
  • 3
  • 21
  • 38

1 Answers1

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) {
  // ...
});
Linus Thiel
  • 38,647
  • 9
  • 109
  • 104