@onesy/utils
Version:
13 lines (12 loc) • 412 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const canvasCrop = (canvas, x, y, width, height) => {
const newCanvas = document.createElement('canvas');
newCanvas.width = width;
newCanvas.height = height;
newCanvas
.getContext('2d')
.drawImage(canvas, x, y, width, height, 0, 0, width, height);
return newCanvas;
};
exports.default = canvasCrop;
;