在html5canvas上按比例调整大小和裁剪图像,如右上角,左上角.....

时间:2016-08-11 21:32:42

标签: html5-canvas

代码

canvas.width=900 //cropping
canvas.height=414 //cropping
ctx.drawImage(img, 0, 0, 900, img.height * (900/img.width)); //resize propportionally
document.body.appendChild(canvas); //show final image

我想不仅从右上角裁剪图像,还要从左上角,中间,左下角,右边的机器人裁剪图像。我该怎么做?

0 个答案:

没有答案
相关问题