Glide+阿里OSS+WebP 图片处理方案
作者:
sufun_wu | 来源:发表于
2017-11-06 21:10 被阅读536次
在实际项目中,图片占用一直是我们接触最多的。为了优化这块,我们主要是从几个方面来处理。
业务需求:
- 根据设备端的控件尺寸,向服务器请求不同经裁剪过后的不同尺寸图片。
2)服务端可以给我们提供webp格式的文件。
阿里云Oss的图片裁剪规则。请参考:
阿里Api:
https://help.aliyun.com/document_detail/44688.html?spm=5176.doc44687.6.945.WXaOMG
里面有特多的规则,我选择的裁剪方案是。

image.png
实际测试图片:
http://igetcool.oss-cn-beijing.aliyuncs.com/test/series/cover/bde098a8-def8-4264-81f4-b9adff41ddff.jpg
最后将一个 404.36 kb的图片

image.png
压缩到了18kb

image.png
除了细看一些些的纹路丢失,其它的,没有任何感知

image.png
git 测试用例
https://github.com/wsf5918/webpAliOss/tree/dev
本文标题:Glide+阿里OSS+WebP 图片处理方案
本文链接:https://www.haomeiwen.com/subject/ndrrmxtx.html
网友评论