Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

图片格式化新参数 #191

Closed
lrhtony opened this issue May 13, 2021 · 5 comments · Fixed by #1061
Closed

图片格式化新参数 #191

lrhtony opened this issue May 13, 2021 · 5 comments · Fixed by #1061
Labels
新增/Add 添加或修改新的内容
Milestone

Comments

@lrhtony
Copy link

lrhtony commented May 13, 2021

目前发现在一些地方(例如网页版的头像)发现了一个参数c,如
https://i2.hdslb.com/bfs/face/81426dd08a88727d2b4c4fbbb9d6b957f871b0b1.png@120w_120h_1c.webp
值为[0,1]
作用尚不明确

@lchzh3473
Copy link

lchzh3473 commented May 14, 2021

个人遍历了26个字母,测试总结了一些结果
格式:(图像原链接)@(\d+[whsepqoc]_?)*(\.(|webp|gif|png|jpg|jpeg))?$
w:[1, 9223372036854775807] (width,图像宽度)
h:[1, 9223372036854775807] (height,图像高度)
s:[1, 9223372036854775807] (作用未知)
e:[0,2] (resize,0:保留比例取其小,1:保留比例取其大,2:不保留原比例,不与c混用)
p:[1,1000] (默认100,放大倍数,不与c混用)
q:[1,100] (quality,默认75,图像质量)
o:[0,1] (作用未知)
c:[0,1] (clip,0:默认,1:裁剪)
webp,png,jpeg,gif(不加则保留原格式)
不区分大小写,相同的参数后面覆盖前面
计算后的实际w*h不能大于原w*h,否则wh参数失效

@mckuhei
Copy link
Contributor

mckuhei commented May 19, 2021

个人遍历了26个字母,测试总结了一些结果
格式:(图像原链接)@(\d+[whsepqoc]_?)*(\.(|webp|gif|png|jpg|jpeg))?$
w:[1, 9223372036854775807] (width,图像宽度)
h:[1, 9223372036854775807] (height,图像高度)
s:[1, 9223372036854775807] (作用未知)
e:[0,2] (resize,0:保留比例取其小,1:保留比例取其大,2:不保留原比例,不与c混用)
p:[1,1000] (默认100,放大倍数,不与c混用)
q:[1,100] (quality,默认75,图像质量)
o:[0,1] (作用未知)
c:[0,1] (clip,0:默认,1:裁剪)
webp,png,jpeg,gif(不加则保留原格式)
不区分大小写,相同的参数后面覆盖前面
计算后的实际wh不能大于原wh,否则wh参数失效

学到了

@SocialSisterYi SocialSisterYi added the 新增/Add 添加或修改新的内容 label May 19, 2021
@SocialSisterYi
Copy link
Owner

SocialSisterYi commented May 19, 2021

谢谢大佬提供

@lchzh3473
Copy link

lchzh3473 commented Apr 12, 2022

个人遍历了26个字母,测试总结了一些结果 格式:(图像原链接)@(\d+[whsepqoc]_?)*(\.(|webp|gif|png|jpg|jpeg))?$ w:[1, 9223372036854775807] (width,图像宽度) h:[1, 9223372036854775807] (height,图像高度) s:[1, 9223372036854775807] (作用未知) e:[0,2] (resize,0:保留比例取其小,1:保留比例取其大,2:不保留原比例,不与c混用) p:[1,1000] (默认100,放大倍数,不与c混用) q:[1,100] (quality,默认75,图像质量) o:[0,1] (作用未知) c:[0,1] (clip,0:默认,1:裁剪) webp,png,jpeg,gif(不加则保留原格式) 不区分大小写,相同的参数后面覆盖前面 计算后的实际wh不能大于原wh,否则wh参数失效

似乎还能加上progressive,但作用依然未知(例:https://i1.hdslb.com/bfs/archive/cd8e49003728a026bcd19d71d7a41048fed55097.jpg@progressive

@xiaoyv404 xiaoyv404 added this to the API Update milestone Nov 26, 2023
@xiaoyv404 xiaoyv404 reopened this Nov 26, 2023
@SessionHu
Copy link
Contributor

SessionHu commented Jul 25, 2024

  • progressive 与 JPEG 图片编码方式有关, 与对于图片的加载方式有关系, 以下是两种参数文件的 file 命令输出.
    noprogressd.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 990x618, components 3
    progressive.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, progressive, precision 8, 990x618, components 3
    
  • 关于 JPEG 编码方式: baseline 是从上到下逐行加载的, 一般图片体积较小. progressive 在加载时会先显示一个低分辨率的版本, 然后随着数据的不断加载, 图像的细节逐渐增加, 最终显示完整的图像, 这种方式类似于扫描的过程, 从模糊到清晰, 体积一般较大.
  • 但实际测试下来, 发现 progressive 居然比原图体积还要小一点. 以下是 ls -l 的输出.
    -rw-r--r-- 1 sess sess 85K Sep  2  2021 noprogressd.jpg
    -rw-r--r-- 1 sess sess 52K Sep  1  2021 progressive.jpg
    
  • 测试图片原文档与该 Issue 均尝试, 结果相同.
  • PNG 图片上则是关于 non-interlaced(非交错格式)interlaced(交错格式), 与上述 JPEG 类似, 但文件大小交错格式略大.
  • 在 AVIF 图片上使用会导致图片变为 WebP 格式, 但是服务器返回 Content-Type 标头仍为 image/avif.
  • 参数 progressive 对于 WebP 图片无效.
  • 另外参数 c 的范围是 [0, 3]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
新增/Add 添加或修改新的内容
Projects
None yet
6 participants