cropperjs icon indicating copy to clipboard operation
cropperjs copied to clipboard

How to add two crop boxes on an image and how to get their preview for each

Open JuGit-pk opened this issue 1 year ago • 1 comments

I want to add two selections on an image, to crop from two different portions of an image and preview them simultaneously.

Screenshot 2023-02-25 at 8 11 42 PM

JuGit-pk avatar Feb 25 '23 15:02 JuGit-pk

const selection = document.getElementsByTagName('cropper-selection');

for (let i = 0; i < selection.length; i++) {
  const selectionone = selection[i];
 
  const data = await selectionone.$toCanvas();

  var imgbase64 = data.toDataURL('image/png');
  console.log(imgbase64);
}

xcc1995 avatar Jun 14 '23 04:06 xcc1995

Ref this example: https://fengyuanchen.github.io/cropperjs/v2/api/cropper-selection.html#multiple

fengyuanchen avatar Aug 18 '24 08:08 fengyuanchen