I have created an upload image functionality with express 4 and I want to, in the process, create several different sizes and shapes for the uploaded image.
mkdirp(smallPath, function (err) {
if (err) {
console.error('resizeImg err='+err+']');
return;
} else {
gm(basePath+'/original/'+image)
.resize(35, 35)
.noProfile()
.write(smallOutputFilePath, function (err) {
if (err) console.log(err);
});
}
Now, I want this 35x35 image to be cropped circled with transparent background. Like this:
I found this similar question: Rounded corner using gm in nodejs. But the answer uses command line ImageMagick and I wanted to use gm methods and capabilities. Does anybody knows how to solve it?
After a while, I decided to migrate to the great node-easyimage. It gives me more flexibility and allows me to reproduce my command line taking advantages of callbacks for success and error responses.
The imagemagick plugin is really deprecated