Cropper.JS uploading file size issue

3.4k views Asked by At

I am facing issue while using Cropper.JS to upload and crop the images. Suppose I am uploading 70 kb file after using cropper tool it's size get increased and is 115KB and sometime it's also converting to MB's for some other file sizes.

2

There are 2 answers

1
Puneet Uppal On

From my understanding you should have to use newer version of cropper.

0
Jcdev On

If you are facing to size of cropped image problem, you can transform the cropped image to base64 and compress it by using the following code snippet (angular-cropperjs)

this.angularCropper.cropper.getCroppedCanvas().toDataURL('image/jpeg', (20 / 100));

Play with the second parameter of toDataURL() method to adjust ratio compression.

You can find more information here.