The difference between image file size by getBytesAsync() and the original image size

I’m developing Figma plugin.
I want to send images selected by user to my own server.
I hope that I want to know the size of each images before I send it to the server, for screening images by its size.

I noticed that the image size by getBtyesAsync method (actually the length of the uint8array) is much smaller than the actual image size that I pasted to the canvas from my clipboard.

For my example, I got this console log.

[Image] Generating thumbnail from image image, drop 2 mips, 1920x1080 7.91 MB to 480x270 0.49 MB

And the length of the uint8array was 269145.

I guess Figma might have its own compression step for images.
I want to know the relationship between each sides.
Can anyone explain why briefly and the relational expression between the byte length by getBytesAsync and actual image size?

Thank you.

1 Like