Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rounded corner using gm in nodejs

I am trying to round corners on an image using nodejs to process the images. I feel like the best library to do this would be gm but since I cannot use gm I have to use the imagick adapter as such


var gm = gm.subClass({ imageMagick: true });

gm("img.jpg").autoOrient().resize(50, 50).write('/path', callback);

From here I cannot figure out how to get rounded corners. I do not want to do this in css since it is for a mobile app and client size it makes lags. Edges must be smooth.

like image 309
Steeve17 Avatar asked Sep 28 '26 20:09

Steeve17


1 Answers

imagemagick.convert([
            "-size", width + "x" + height,
            "xc:none",
            "-fill", dest,
            "-draw",
            "circle " + (width / 2) + "," + (width / 2) + " " + (width / 2) + ",1",
            dest
            ], function(err) {
                return done(err);
            });
like image 62
Steeve17 Avatar answered Sep 30 '26 12:09

Steeve17