[英]node-canvas image manipulation
I'm trying to resize and crop an image in node.js我正在尝试调整和裁剪 node.js 中的图像
I've been using graphicsmagick:我一直在使用graphicsmagick:
code is as follows:代码如下:
gm(path)
.resize(width, height)
.crop(50, 50, left, top)
.write(path, function(err){})
It's very simple.这很简单。 I have no idea how to use canvas, what's the equivalent in canvas?我不知道如何使用 canvas,canvas 中的等价物是什么?
Thanks.谢谢。
For some reason, this signature is never used in examples:出于某种原因,此签名从未在示例中使用:
context.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh);
Crop using sx, sy, sw, sh使用 sx、sy、sw、sh 进行裁剪
Resize using dw, dh使用 dw、dh 调整大小
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.