微信小程序选择图片优化_如何选择完美的图像格式来优化您的网站

微信小程序选择图片优化This article was sponsored byCloudinary. Thank you for supporting the partners who make SitePoint possible. 本文由Cloudinary赞助。 感谢您支持使SitePoint成为可能的合作伙伴。 When adding images to a website, mo...
摘要由CSDN通过智能技术生成

微信小程序选择图片优化

This article was sponsored by Cloudinary. Thank you for supporting the partners who make SitePoint possible.

本文由Cloudinary赞助。 感谢您支持使SitePoint成为可能的合作伙伴。

When adding images to a website, most of us will instinctively know to avoid using a GIF for a photo and avoid using a JPEG for a graph. The lazy ones among us – i.e., me – may just opt for PNG for everything and hope for the best.

当将图像添加到网站时,我们大多数人会本能地知道要避免对照片使用GIF,而对图形不使用JPEG。 我们中间那些懒惰的人(即我)可能只是为所有内容选择PNG,并希望做到最好。

So why do we do this? It all comes down to the encoding used to create the image in a particular file format. JPEG suits photography (the “P” stands for “Photographic”) since it blurs sharp edges but preserves smooth gradients. Encoding an image with large, sharply-defined blocks of color using JPEG causes loss of definition and inefficient encoding.

那么为什么我们要这样做呢? 全部归结为用于以特定文件格式创建图像的编码。 JPEG适合摄影(“ P”代表“摄影”),因为它模糊了锐利的边缘但保留了平滑的渐变。 使用JPEG对带有大尺寸,清晰定义的颜色块的图像进行编码会导致清晰度下降和编码效率低下。

Conversely, GIF suits logos or simple block graphs, since it focuses on the changes between uniform regions of color. This is obviously pretty useless for photos, where the colors differ almost pixel by pixel.

相反,GIF适合徽标或简单的方框图,因为它着重于颜色均匀区域之间的变化 。 对于颜色几乎逐个像素变化的照片,这显然是毫无用处的。

As an example, this image comes in at 106Kb as a JPEG:

举例来说,此图片以JPEG格式传入时106Kb

JPEG photograph

However, it reaches a whopping 517Kb encoded as a GIF. That’s almost 5 times bigger just by using an inappropriate image format. Oh dear.

但是,它达到了编码为GIF的高达517Kb 。 仅使用不适当的图像格式,它的大小几乎原来的5倍 。 噢亲爱的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值