Question : how to resize a base64 image
Answered by : emmanuel-mahuni
function imageToDataUri(img, width, height) { // create an off-screen canvas var canvas = document.createElement('canvas'), ctx = canvas.getContext('2d'); // set its dimension to target size canvas.width = width; canvas.height = height; // draw source image into the off-screen canvas: ctx.drawImage(img, 0, 0, width, height); // encode image to data-uri with base64 version of compressed image return canvas.toDataURL();
}
Source : https://stackoverflow.com/questions/20958078/resize-a-base-64-image-in-javascript-without-using-canvas | Last Update : Fri, 13 May 22