Search code examples
node.jsgraphicsmagick

Rectangle with only outline and no fill gm nodejs


I am trying to draw a rectangle on top of an image using below code to have nothing filled in the rectangle. That is transparent and only outline of rectangle. But I am not able to do it. Is there a way to achieve that? Thanks.

var gm = require('gm').subClass({imageMagick: true});
var picGm = gm(inputFile)
picGm.drawRectangle(589, 424, 620, 463)

I tried below but it made the rectangle disappear.

picGm.fill("none").drawRectangle(589, 424, 620, 463)

Solution

  • Found a solution

    picGm.stroke("#FFFFFF", 0).fill("rgba( 255, 255, 255 , 0 )").drawRectangle(589, 424, 620, 463)