Issue
I have an image converted to base64-string. I convert base64-string to Uint8Array by code:
const BASE64_MARKER = ';base64,';
function convertDataURIToBinary(dataURI) {
const base64Index = dataURI.indexOf(BASE64_MARKER) + BASE64_MARKER.length;
const base64 = dataURI.substring(base64Index);
const raw = window.atob(base64);
const rawLength = raw.length;
const array = new Uint8Array(new ArrayBuffer(rawLength));
for (let i = 0; i < rawLength; i++) {
array[i] = raw.charCodeAt(i);
}
return array;
}
I don't know how to crop it. Can you help me to implement the algorithm?
Solution
Thank you, mpm and YAHsaves. I decided to use canvas and it works easy and quickly. Here is the link to npm package. I hope, it can help other people to crop and resize images in browser using canvas.
Answered By - user3517175 Answer Checked By - Willingham (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.