简体   繁体   English

使用 ngx-image-cropper 在单个图像上的多个裁剪框

[英]Multiple cropper box on single image with ngx-image-cropper

I am working with angular for image cropping task.我正在使用 angular 进行图像裁剪任务。 Image is having multiple faces that need to be select on mouse click.图像有多个面,鼠标单击时需要为 select。 How can we add multiple cropper box with npm package for angular 'ngx-image-cropper' or any other solution on this?我们如何使用 npm package 为 angular 'ngx-image-cropper' 或任何其他解决方案添加多个裁剪框?

I don't think it is a good idea to have multiple crop boxes at the same time.我认为同时拥有多个裁剪框不是一个好主意。 Keep the source image on the screen and try to crop one by one.将源图像保留在屏幕上,并尝试一张一张地裁剪。 imageCropped event of ngx-image-cropper provides you the base64 image of the selected area. ngx-image-cropper 的 imageCropped 事件为您提供所选区域的 base64 图像。 Example usage:示例用法:

onImageCropped(event: ImageCroppedEvent) {
    console.log(event.base64);
}

Add a save button to the page and store the selection in an array.将保存按钮添加到页面并将选择存储在数组中。 Use them whenever you need.在需要时使用它们。 You can also show them in a div and delete any of them.您还可以在 div 中显示它们并删除它们中的任何一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM