var crop_canvas = document.createElement('canvas');
crop_canvas.width = rcWidth;
crop_canvas.height = rcHeight;
crop_canvas.getContext('2d').drawImage(image_target, rcLeft, rcTop, rcWidth, rcHeight, 0, 0, rcWidth, rcHeight);
image_target
is having the image element
rcLeft
: x coordinate for cropping
rcTop
: y coordinate for cropping
rcWidth
: width of cropped image
rcHeight
: height of cropped image
Considering we do not need to crop the image, we just need a copy of the image.
The copy created is of greater size ie.If the image is of 1MB. The copy created is of 5MB approx.