Closed HuakunShen closed 1 year ago
Not sure if it's possible to reference a image file on disk, because reading bytes is still quite slow.
I just found that reading large image to base64 and display was slow in dev mode. If I make a production build, it's actually quite fast.
Interestingly, in a production build, reading and displaying base64 image seems to be faster than reading bytes (array of int) and convert to Uint8Array then blob then object URL. The reason is probably: rust is a lot faster, and single-threaded JS got blocked during conversion.
Reading base64 seems to be the best option so far. I may still add the readImageBinary
method for people who need it.
Further experiment is needed.
Currently base64 is returned to frontend. For large image, this could be slow. I would like to include a
readImageBinary
method.