Skip to content
Advertisement

JavaScript: Multiple cropping selection in one image?

PS: Is it not a research kind of question! I have been trying to do this from very long time.

I am trying to make web based an image editor where user can select multiple cropping area and after selection save/download all the image area. like below.

As of now I discovered two libraries

1.Cropper.JS where is only single selection feature is available.

2.Jcrop where only single selection area restrictions.

I am currently using cropper.Js but it seems impossible for me to make multiple selection cropping. Any help is much appreciated.if any other method/library available in JavaScript, Angular or PHP or reactJS for multiple image area selection and crop and download in one go as in the image below.

enter image description here

As per @Keyhan Answer I am Updating my Jcrop library Code

JavaScript

JavaScript

JavaScript

Advertisement

Answer

I tried to explain the code with comments:

JavaScript

EDIT: As you commented it would be nicer if we have local image loader, we can add a file input to our html

JavaScript

and a function to our js to handle it

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement