I'm trying to generate following image:
this is my code. I'm using out command to set fix with to font:
const gm = require("gm").subClass({ imageMagick: true });
gm(1800, 2400, "transparent")
.fill("#ffffff")
.drawRectangle(400, 400, 1400, 1400)
.font("ananda.ttf", 90)
.background("transparent")
.out(
"-size",
"1600",
"-gravity",
"center",
"caption: very very very long text very very very long text long long",
"-geometry",
"+0+400",
"-composite"
)
.write("drawing.png", function (err) {
if (err) return console.dir(arguments);
console.log(this.outname + " created :: " + arguments[3]);
});
but when I'm trying to add .composite(foregroundImagePath)
before or after out, it's not working.
'0': Error: Command failed: composite: unrecognized option
-fill' @ error/composite.c/CompositeImageCommand/1021.`
- is there better way to rather use
out
command? - how to add final picture to the image?