Cropper
Cropper.js
px
px
px
px
deg
<!-- Wrap the image or canvas element with a block element (container) -->
<div>
<img id="image" src="picture.jpg" alt=""/>
</div>
// import 'cropperjs/dist/cropper.css';
import Cropper from 'cropperjs';
const image = document.getElementById('image');
const cropper = new Cropper(image, {
aspectRatio: 16 / 9,
crop(event) {
console.log(event.detail.x);
console.log(event.detail.y);
console.log(event.detail.width);
console.log(event.detail.height);
console.log(event.detail.rotate);
console.log(event.detail.scaleX);
console.log(event.detail.scaleY);
},
});