This post was published in 2022-05-25. Obviously, expired content is less useful to users if it has already pasted its expiration date.
Table of Contents
strace nginx
我给我的博客提供了webp和avif的支持,但nginx access.log并不记录webp/avif被读取了,我应该如何得知这些压缩图片确实被nginx读取了?
使用 strace ,参考:🔗 [gzip - How can I check that the nginx gzip_static module is working? - Stack Overflow] https://stackoverflow.com/questions/2460821/how-can-i-check-that-the-nginx-gzip-static-module-is-working,回答备份截图
anaconda pycurl
完整文章见:🔗 [PycURL的性能取决于安装方法和编译依赖 - Truxton's blog] https://truxton2blog.com/pycurl-performance-differs/
anaconda环境下安装pycurl经常出问题,如果不想配置openssl那些路径参数,有一种简洁不容易报错的安装方法:
$ conda install -c anaconda pycurl
来自:https://stackoverflow.com/a/55197682
测试avifenc的不同参数
(如无特别声明,默认cq-level=18)
(1)测试用图片:https://upload.wikimedia.org/wikipedia/commons/7/74/A-Cat.jpg
图片 | 大小(Byte) | 执行时间 | 通过avifdec变回jpg的大小 | butteraugli |
原图 | 2.2M | |||
speed=6 (默认) | 764K | 8.6 s | 1.3M | 2.938205 |
speed=5 | 844K | 22.4 s | ||
speed=4 | 856K | 29.1 s | 1.4M | 2.572569 |
speed=3 | 868K | 66 s | ||
speed=2 | 876K | 93 s | 1.4M | 2.423154 |
speed=0 | 876K | 1.4M | 2.763549 | |
speed=7 | 804K | 8.1 s | 1.3M | 3.297063 |
speed=8 | 376K | 4.5 s | 1.1M | 4.537639 |
speed=9 | 376K | 3.2 s | ||
speed=10 | 376K | 3.2 s | ||
speed=6,但cq-level=27 | 368K | 1.2M | 4.698296 | |
对同一张图继续测试,这次侧重关注:speed能否带来较大的质量提升?
由于相近大小的图片很难凑出,只能尽可能大小接近了:
图片 | 大小 | butteraugli |
speed=6,但cq-level=30 | 276K | 5.918262 |
speed=4,但cq-level=31 | 248K | 6.385068 |
speed=7,但cq-level=18 | 804K | 3.297063 |
speed=4,但cq-level=19 | 828K | 2.684392 |
speed=8,但cq-level=18 | 376K | 4.537639 |
speed=6,但cq-level=26 | 384K | 4.315894 |
speed=6,但cq-level=27 | 368K | 4.698296 |
speed=4,但cq-level=27 | 372K | 5.513559 |
结论:
暂时没有结论。avif实在是太迷了。考虑到speed<6实在是太慢,而且butteraugli评分不稳定,目前还是老老实实放弃其他参数,专心使用 cq-level 调整大小吧。