What is the effect of encoding an image in base64?

后端 未结 6 976
鱼传尺愫
鱼传尺愫 2020-11-22 07:21

If I convert an image (jpg or png) to base64, then will it be bigger, or will it have the same size? How much greater will it be?

Is it recommended to use base64 enc

6条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 07:53

    Encoding an image to base64 will make it about 30% bigger.

    See the details in the wikipedia article about the Data URI scheme, where it states:

    Base64-encoded data URIs are 1/3 larger in size than their binary equivalent. (However, this overhead is reduced to 2-3% if the HTTP server compresses the response using gzip)

提交回复
热议问题