AVIF has landed (2020)
jakearchibald.com
jakearchibald.com
And apple doesn't give ios uses any choice. You are stuck dealing with those differences.
Yeah, that's by far the worst part. Imagine being stuck with IE indefinitely. :)
https://www.coywolf.news/webmaster/why-webkit-supports-avif-...
<!-- wrapper element -->
<picture>
<!-- avif srcset: 1x, 2x, 3x as auto select higher quality images for higher screen resolutions -->
<source srcset="/img/articles/iphone-3566282_235.avif 1x, /img/articles/iphone-3566282_235@2x.avif 2x, /img/articles/iphone-3566282_235@3x.avif 3x" type="image/avif">
<!-- webp srcset -->
<source srcset="/img/articles/iphone-3566282_235.webp 1x, /img/articles/iphone-3566282_235@2x.webp 2x, /img/articles/iphone-3566282_235@3x.webp 3x" type="image/webp">
<!-- jpeg also as srcset to provide screen resolution based images -->
<source srcset="/img/articles/iphone-3566282_235.jpg 1x, /img/articles/iphone-3566282_235@2x.jpg 2x, /img/articles/iphone-3566282_235@3x.jpg 3x" type="image/jpeg">
<!-- fallback image with loading=lazy, to load images only when visible -->
<img src="/img/articles/iphone-3566282_235.jpg" alt="Access and recover files from an iPhone on Linux" title="Access and recover files from an iPhone on Linux" loading="lazy" class="size-235 raster ext-jpg" width="235" height="129">
</picture>
Using this on https://pilabor.com/Needs:
AddType image/avif .avifAlso, upon further investigation, I think both browsers are displaying the AVIF for me. It has quite a bit less detail than the JPEG, so it's identifiable.
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME}.webp -f
RewriteRule ^/?(.+?)\.(jpe?g|png)$ /$1.$2.webp [NC,T=image/webp,E=EXISTING:1,E=ADDVARY:1,L]
<FilesMatch "(?i)\.(jpe?g|png)$">
Header append "Vary" "Accept"
</FilesMatch>
Then <img src="image.jpg"> will serve the supported format.<img src="image"> without extension on the URI will pick the user-agent's best accepted format from the set of files `image.*`.
I see some conflicting advice in this thread and from what little I’ve looked into it, there isn’t a good consensus on the subject yet?
Here's a comparison that has AVIF, JPEG-XL, mozjpeg, and others: https://afontenot.github.io/image-formats-comparison/
The article is trying to demonstrate how much more compression is achieved by trying to keep relative image quality the same. That’s fine normally but when you have a broad population looking at it then it’s going to be a lot of nitpicking which isn’t helpful when you’re trying to communicate about the codec quality (and no benchmark is perfect but it’s pretty clear that AVIF is roughly 20% or better than H265 if I recall correctly - good luck being able to measure a 20% relative difference in image quality by hand).
I disagree thought mostly about the codec characterization. H265/AV1 are definitely higher quality at the same bitrate. The test I used is to find the bitrate that artifacts started to be noticeable. H265 was 15-20% smaller bitrate consistently (across multiple people surveyed, not just me). I could definitely believe that AV1 manages a similar feat above that.
I dont want 15KB, because difference between 15 and 70 is 5 milliseconds.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/im...
Requiring listed size/quality for all the sources might not even be feasible without further automation on the server side, not to mention potential content mangling/"optimizing" proxies/appliances.
If I could add to the spec, I would put something for lofi/hifi. Then of course that is all subjective and developers will eventually use it in problematic ways.
There's already enough gaming around pagespeed scores. If such an incentive is added, the spec needs to be formulated in an ergonomic way to avoid mal-optimizations.
And I want it, as on travelling or mobile I'm golden if I get 1 MBit/s (= 128 KiB/s) download bandwidth, more often it's around 300-400 KBit/s (37-50 KiB/s), so:
1 MBit/s and one image -> 546 ms vs. 117 ms
300 KBit/s and 1 image -> 1892 ms vs. 405 ms
Most sites have more than one image, say five for some realistic example: 1 MBit/s BW:
AVIF 15 KiB: 0.6s
JPEG 70 KiB: 2.7s
300 KBit/s BW:
AVIF 15 KiB: 2.0s
JPEG 70 KiB: 9.5s
That's both quite the noticeable difference.In my residence I'm lucky and get 100+ Mbit/s and even 1 GBit/s at work, but there are lots of countries in the world that don't and once one is affected by that, like I on my train travels, it gets really noticeable which sites have low-bandwidth ignorant engineers, causing not only frustration but often actually impacting life in more meaningful ways negatively.
Personally I'm trying to push for JXL (for high fidelity) and AVIF (for when lower fidelity is acceptable) adoption at work. With absolutely no success yet but as it matures I'm sure things will turn around.
Firefox: about:config, image.jxl.enabled
Chromium: about:flags, Enable JXL image format
https://avif.io/blog/comparisons/avif-vs-jpegxl/#speed
And here is the current state for Safari:
It looks like you still have to keep jpg/png around for a few years at least. Even if you drop IE11, there's a few versions of Safari out there that don't support even WebP.
So the pipeline would be:
* png -> resize -> png/lossless webp * jpg/other -> resize -> jpg/webp
Where "other" is whatever format iPhone cameras use.
Is there anything I'm missing if I were to do this today?
but there's a limit on what can be done with the primitives that jpeg offers. for example, jpeg is stuck with the older huffman coding for the entropy encoding part, instead of the better arithmetic coding or asymetric numeral systems
JPEG XL is a new format with a new file extension jxl, but it does have backwards compatibility features that look pretty nice. Maybe that's what you want.
I wonder if machine learning/deep-fake technology has created even better compression algorithms.
I suggest looking into JPEG XL for things like photography, scans, etc.
A new format is good as long as firmwares can encode it at good speed.