1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-12-24 01:42:10 +00:00

Correction: s/image-compression/max-bpp/

This commit is contained in:
Rohan Kumar 2022-08-12 17:08:43 -07:00
parent 6e59bd76d8
commit 1e00ee0bec
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479

View file

@ -5,13 +5,13 @@ replyURI: "https://github.com/wicg/document-policy/blob/main/document-policy-exp
replyTitle: "Document Policy Explainer"
replyType: "TechArticle"
---
Interaction between the Document-Policy `image-compression` directive and a user-agent's supported image formats is currently unspecified.
Interaction between the Document-Policy `*-images-max-bpp` directive and a user-agent's supported image formats is currently unspecified.
Next-gen image formats of the present and future include WebP, AVIF, JPEG-XL, and WebP2. With every new format, new compression ratios become possible; however, cross-browser support is inconsistent. That means possible compression ratios also vary by browser. Fewer supported image formats should allow a less aggressive compression ratio in the Document Policy. Unfortunately, browsers' `Accept` request headers don't always report supported image formats, so servers can't easily compute the best policy for a given browser.
Specifying a per-mimetype compression ratio isn't ideal. Sometimes a PNG can beat AVIF or come close enough to not justify the extra bytes of a `<picture>` element. On a browser with AVIF and PNG support, loaded PNGs should be held to AVIF-level compression expectations.
I think the most robust solution would be to offer multiple image-compression policies to a browser; the browser can then pick the policy that matches its supported image formats. For instance: a server could offer a `image-compression-supports-webp`, `image-compression-supports-webp-avif`, `image-compression-supports-webp-avif-jxl`, etc. Unfortunately, this is really wordy and will only grow more complex as browsers adopt new image formats.
I think the most robust solution would be to offer multiple image-compression policies to a browser; the browser can then pick the policy that matches its supported image formats. For instance: a server could offer a `max-bpp-supports-webp`, `max-bpp-supports-webp-avif`, `max-bpp-supports-webp-avif-jxl`, etc. Unfortunately, this is really wordy and will only grow more complex as browsers adopt new image formats.
TLDR: in a web where supported image formats can vary, it's unclear how `image-compression` and a UA's supported image formats should interact. This variance warrants a policy more complex than a single global value.
TLDR: in a web where supported image formats can vary, it's unclear how `*-images-max-bpp` and a UA's supported image formats should interact. This variance warrants a policy more complex than a single global value.