I have tried using canvas.toDataUrl
and canvas.toBlob
to get an base64 encoded string of an image (screenshot).
In both toDataUrl
and toBlob
, you can set the mime type as image/jpeg
, image/png
and image/webp
, but can you set it to none, or application/octet-stream
?
ex.
let imgData = renderer.domElement.toDataURL('applicaton/octet-stream');
Whenever I try to do that, it just encodes it with image/png
mime type.
If it's not possible, how can I get a base64 encoded string of an image with application/octet-stream
mime type?
The mime-type you pass in these function is a hint for the browser as to which encoder they should use to generate an image file.
application/octet-stream
doesn't correspond to any image encoder and is thus not supported by any browser.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.