The HTML5 Canvas API draws the uploaded image and exports it via canvas.toDataURL(mimeType, quality). Compressed file size is estimated from the length of the base64-encoded output. Quality loss is ...