Advantages and disadvantages of using base64 encoded images

前端 未结 4 935
忘掉有多难
忘掉有多难 2020-12-08 09:15

I am thinking of using base64 encoded images for a site I am working on to optimize the load time.

Anyways, before I start, I was wondering: what are the advantages

4条回答
  •  庸人自扰
    2020-12-08 09:49

    the actual length of MIME-compliant Base64-encoded binary data is usually about 137% of the original data length, though for very short messages the overhead can be much higher due to the overhead of the headers. Very roughly, the final size of Base64-encoded binary data is equal to 1.37 times the original data size + 814 bytes (for headers).

    In other words, the size of the decoded data can be approximated with this formula:

    bytes = (string_length(encoded_string) - 814) / 1.37
    

    Source: http://en.wikipedia.org/wiki/Base64#MIME

提交回复
热议问题