Have you tried Google's jpegli encoder? I find that it generally matches webp for most image types. Quantized png is usually best for anything with a limited color palette though.
ChadNauseam 9 hours ago [-]
Webp is much better for lossless.
I have a similar tool at https://pictolab.io. I use it for tweaking the brightness and satuation of images mostly. For that you want HDR to reduce clipping, and most image formats have surprisingly bad HDR support besides AVIF (and jxl). Jpeg kinda supports it with gain maps but it's kind of tacked-on to the spec. Webp doesn't support HDR at all.
It's also surprisingly hard to support HDR input. For example, Apple uses a weird poorly documented format for the HEIC their iPhones take. I feel like HDR is just kind of a mess right now.
TurboSkyline 12 hours ago [-]
> for screenshots though, and WebP works better for those
Interesting! Better in terms of more quality preserved or smaller file size? Have you found other types of images where this applies?
NelsonMinar 9 hours ago [-]
Lol I went through that same webp-vs-avif thing. AVIF supports HDR, so that's a good reason to switch.
thekid314 12 hours ago [-]
Absolutely agree, for my photo portfolio website AVIF allows me to serve higher quality photos faster to potential clients.
AVIF consumes around 25 times more CPU during encoding as JPEG. Take this in consideration if you pay for the power consumption. And on the user-facing side, if you upload an images it takes f.ex. 12 seconds (sic!) and not half a second.
jeroenhd 11 hours ago [-]
12 seconds? It takes 7 seconds on my phone, in a wasm runtime using an older version of the encoder.
From my experience throwing random JPEGs at it, it's 3 to 4 times smaller, that's a good chunk of data saved, which in turn is a lot of energy saved on visitors' radios being active.
Unlike with jpeg, you don't need 85 or 95 percent on the quality score, 50 is more than good enough for most pictures on a website.
If you're hosting images and want a fully lossless encoding the CPU time may become a factor, but if you're hosting user generated content, I don't think it's all that bad. Plus, you can just move the encoding part to the user side of the equation and pretend it's part of the upload progress bar if you're desperate to pay the power bill.
Aldipower 10 hours ago [-]
The numbers above coming from a test run on one of my own servers serving and receiving user generated images. It is a Intel E5 56 CPU threads machine with DDR4 RAM. A single thread may be slower then your phone CPU cores, but that's what you find very often when running servers.
jeroenhd 4 hours ago [-]
I see, I can imagine a decade old CPU without any kind of video acceleration taking a while indeed. Technology has come a long way since the E5-2690v4.
Still, when encoding AVIF, there are various quality options to choose from, and the encoder has gotten better over the past year. On my i3-2120 NAS (which even your E5 should beat on single core perf), encoding an image at default speed takes about 4-6 seconds (JPEG about 2s), while producing an image of comparable quality a third the size. If I pass --speed 10, converting PNG to AVIF takes only half a second.
The standard AV1 encoder has improved a lot over a short amount of time, I invite you to run another benchmark, you may be surprised.
brigade 9 hours ago [-]
You can adjust the speed of both, you don't have to use the default of whatever library versions you're using. My cjxl defaults to 2x more CPU than avifenc's default, but I can make it 30x more or 480x less; libaom certainly lets you waste a lot more CPU than libjxl, if that's what you want.
I don't know if anyone has published an encode time / quality comparison of the various encoders. It'd have to be recent to include this year's libaom image optimizations.
remix2000 11 hours ago [-]
Does AVIF carry the same patent risks as full/motion AV1?
(I’m not saying I support the claims or not, I have no idea about their technical and let alone legal merit, just thinking that there are attempts at enforcement against sites streaming AV1 and whether choosing AV1 puts say my site at risk)
theandrewbailey 10 hours ago [-]
Probably not. But if anyone ever decides to enforce patents over AV1 or AVIF, they will fight about every company in Big Tech and quite a bit of Hollywood: https://aomedia.org/about/members/
remix2000 8 hours ago [-]
It’s actually shared patent pool with H265, most big tech companies already license it for the latter, there was some litigation with Snapchat I think regarding AV1. Royalties are for distribution, I assume, so posting AV1 video might be a no-no. I meant to ask if the ‘patented’ stuff is even used when encoding an image. (NB the codec is not patented, nobody claims that afaik, but rather it might be patent encumbered, as in it uses algorithm that might be patented as a part of its design)
chrismorgan 11 hours ago [-]
Yes. It’s just an AV1 container. Doesn’t even need to be limited to a single frame (just like GIF and APNG).
shmerl 11 hours ago [-]
Hard to say, but possibly less since it's a still image, not a video, so it inherently corresponds only to a part of AV1.
No need to worry about these risks for using it though. You can never say that no patent troll will surface tomorrow for literally anything. That's not a reason not to use things.
extra88 1 hours ago [-]
AVIF supports multiple frames. It's a good replacement for animated GIFs.
shmerl 32 minutes ago [-]
I don't think you need a replacement for them besides actual proper video.
Dylan16807 9 hours ago [-]
> You can never say that no patent troll will surface tomorrow for literally anything.
Well I guess you can use 20+ year old standards when they exist.
shmerl 7 hours ago [-]
Yeah, but that's a pretty long time for image formats, so it defeats the point.
xp84 9 hours ago [-]
Hosting providers don't want these formats because they're more cpu-intensive for them to decode and transform (e.g. to make a thumbnail, or when you upload a 4K selfie to be cropped into a 256x256 circle avatar, or a 16 megapixel image of a receipt).
By contrast, if you let the user upload a JPEG or even a PNG, you might pay a slightly-higher cost of the incoming bandwidth, but then you (basically for free) transform the image to the small dimensions and format you actually need, and from there the bandwidth is barely a problem.
Sidenote: End users hate WEBP because nearly any software other than web browsers still don't support even reading it, let alone outputting it (and as you pointed out, anywhere that you "upload an image" they're not welcome either).
In my incredibly shoddy testing sample of 1, my current-macOS device does open AVIFs in Preview, so that's an improvement, at least!
nwah1 12 hours ago [-]
Regular JPEG can also be compressed much more than it usually is:
However, video would matter so much more than images, to the overall internet, that images don't even matter by comparison.
i80and 12 hours ago [-]
It's pretty frustrating that JPEG encoding generally got stuck with libjpeg-turbo.
chrismorgan 10 hours ago [-]
> I have already switched to AVIF on every platform I use that supports it, and WebP where AVIF isn't supported.
Where AVIF isn’t supported, I reckon you’re better to fall back to JPEG. Everything supports JPEG, but there are still plenty of things that don’t support WebP. Anything that supports WebP now has indicated it’s open to supporting newer formats than the baseline JPEG/GIF/PNG and is almost certain to support AVIF within a few years.
origini 12 hours ago [-]
Yeah why not?
Because whenever I download an image and its webp, the next thing i do is i google "webp to png/jpg" conversation because yeah service XY or Tool Z doesn't support it.
Or my Fire TV Stick :(
I configure my nginx to serve everything available though. Thats what i can do.
jeroenhd 11 hours ago [-]
You can throw almost any image format with open standards into squoosh.app if you're still using software that doesn't open webp.
It's been a while since Photoshop finally got support, though, I can't recall the last time webp posed a problem for me. Then again I don't use a Firestick, no idea how that would deal with image formats, I guess it's no longer being maintained?
Jpeg-XL's key win was only lossless translation of existing jpeg to a modern format. Mostly for archives where you don't want a lossy translation.
In terms of picture quality for given size, AVIF has it solidly beat.
mort96 12 hours ago [-]
You could make an argument that we should have AVIF everywhere on the web. But if you want a single image format to be everywhere, I think JPEG-XL is just better suited. AVIF has restrictions on resolutions and number of planes, and doesn't do lossless very well. It's competitive with AVIF on lossy image quality (even though yes, AVIF does seem like it tends to consistently have the advantage there).
brigade 10 hours ago [-]
AVIF supports a higher resolution at 2^32-1 pixels per dimension, vs JPEG-XL's 2^30-1 pixels. But really it doesn't matter since something is going to impose an arbitrarily smaller limit on either before letting you try to allocate more RAM than any computer can address. Yes, plenty of comparison websites confuse AV1 limits (sometimes AV1 profile limits!) with AVIF limits.
For arbitrary planes, AVIF calls them auxiliary images. Unless you mean encoding non-RGB data to start with like how DNG uses JPEG-XL. At which point you're outside the scope of any standard interpretation of JPEG-XL data.
anilgulecha 12 hours ago [-]
Image formats goes in era, and there's no need for monoculture. But given we're talking exabytes of data, for this era, the author rightly articulates why AVIF should win. Should JPEGXL2 beat it in the future then it can take over for a decade. We seem to essentially have gone through like 4 formats so far: gif, jpg, PNG and webp. On vector side, SVG has no real competition - it's solid.
smaudet 10 hours ago [-]
> But given we're talking exabytes of data, for this era, the author rightly articulates why AVIF should win.
I'm not sure this is the right conclusion to draw...
1) The author's pain point (use case) is hardware pricing - presuming that goes down (as either AI demands drops/and or production increases), this does not speak to a demand for size, instead, it is about doing more with less...
2) I'm not certain that the exabytes of demand (assuming it comes) will be from AVIF. Rather, if data is important, I think the demand will be a different format entirely (archives, for instance). Demand for more (quality) data might paradoxically call for less compression and less cpu-intensive qualities - uncompressed, raw data, for instance. If is faster and cheaper than bothering with complex algorithms, then simpler formats should be more prevalent.
Building on 1 and 2, a more capable image format, like JPEG-XL, becomes a more logical choice, not the one that can compress the best or is the smallest (in an exa-byte-as-the-norm world).
mort96 12 hours ago [-]
The author is explicitly arguing for an AVIF monoculture. AVIF isn't an appropriate format for an image format monoculture, but JPEG-XL could be.
"We should use AVIF for most web images" is a different statement which I have no problem with.
bhouston 11 hours ago [-]
> Jpeg-XL's key win was only lossless translation of existing jpeg to a modern format.
Huh?
JpegXL is the only widely supported format (once it comes to the various browser as is planned) that can store true HDR linear images in floating point (fp16 and fp32) formats.
AVIF can only do 10 bit integer ranges, sure that HDR compared to 8bit but it is not sufficient for useful extended range color spaces.
brigade 9 hours ago [-]
The format is widely supported, but I'd be very surprised if linear HDR becomes widely supported outside of image editors. JPEG-XR supported fp32 linear HDR way earlier anyway, and no one cared because no one cares about linear HDR after editing.
Also AVIF supports up to 12 bits.
12 hours ago [-]
xnx 11 hours ago [-]
Agree, though I do miss the clarity of if an image is lossy or lossless just by extension. (Obviously a png could be produced from a heavily compressed jpg, but it is still a handy heuristic in my image pipelines)
jeroenhd 4 hours ago [-]
Aside from maybe .bmp, that never really existed (though .bmp has palletized colours, I guess?).
Just like you can assume most PNGs to be lossless (despite supporting pallettes, which pngquant uses to "compress" them) and non-animated (despite APNG being over 22 years old), you can assume most AVIF and WebP images are lossy. Same with JXL. HEIF requires a bit of special care (it's only produced by devices with HDR support so your pipeline needs to fit that) but that's pretty much it.
You may get surprised by an accidental, huge lossless AVIF/WebP/HEIF file, but most sources where you can even get these files are all lossy. Unless you recompress your photo library yourself, of course, but then you have full control over the entire process and can decide whether or not you want lossy or lossless.
9 hours ago [-]
adzm 9 hours ago [-]
I think we should come up with a convention for this
0x_rs 12 hours ago [-]
Enough keyframe-based "image" formats, please! The internet and the world at large needs a real and proper modern format, not some quick hacks from bored engineers that only contribute to the endless fragmentation online and do not leverage any existing infrastructure for serving video. There's more than just crappy ultra-low-quality thumbnails around. WebP, AVIF are the webscale equivalent of serving images.
iknowstuff 10 hours ago [-]
Say more please, what’s up with keyframes?
Dylan16807 9 hours ago [-]
> Enough keyframe-based "image" formats, please! The internet and the world at large needs a real and proper modern forma
Are you looking for jpeg XL?
> and do not leverage any existing infrastructure for serving video
How would that leveraging work?
> WebP, AVIF are the webscale equivalent of serving images.
This sounds insulting? But they are images on the Web. I have no idea what you mean here.
kasabali 12 hours ago [-]
> Even YouTube is preparing to move beyond AV1 and begin streaming video using AV2, potentially as early as 2027. If a company handling the enormous amount of video that YouTube does sees the benefits of a more efficient format, shouldn't the rest of the internet be taking a closer look at what we can do with images and video too?
Odd argument.
Image isn’t video and we are not YouTube.
thisislife2 10 hours ago [-]
AV1 (and AV2) do save a lot of bandwidth, and Youtube already serves AV1 selectively to some users. But the biggest drawback of AV1 is that it needs more resources to even decode. This is especially apparent on old computers that don't have dedicated AV1 encoders or decoders. I discovered this when someone complained to me that PaleMoon on their old PC suddenly consumed a lot of CPU resource causing the PC to stutter - turned out that Youtube was serving AV1 encoded videos on it. Disabling AV1 support in the browser fixed it as Youtube was then forced to serve AVC / H.264 encoded videos.
d2kx 12 hours ago [-]
not an odd argument. AVIF is based on AV1, so what they mean is that since we accept YouTube's AV1 usage as mainstream nowadays, so should be it's image part
squidmaster 9 hours ago [-]
[dead]
BorisMelnik 12 hours ago [-]
I swear I saw this exact post here on HN last week
flerchin 12 hours ago [-]
Maybe a middle out compression is the way to go.
DivingForGold 2 days ago [-]
Seems about time we have ANOTHER round of serious investigations into collusion in the memory industry artificially driving up prices ...
I added AVIF support to my personal image resizing tool recently - https://tools.simonwillison.net/image-resize-quality - I mostly use that for screenshots though, and WebP works better for those.
I have a similar tool at https://pictolab.io. I use it for tweaking the brightness and satuation of images mostly. For that you want HDR to reduce clipping, and most image formats have surprisingly bad HDR support besides AVIF (and jxl). Jpeg kinda supports it with gain maps but it's kind of tacked-on to the spec. Webp doesn't support HDR at all.
It's also surprisingly hard to support HDR input. For example, Apple uses a weird poorly documented format for the HEIC their iPhones take. I feel like HDR is just kind of a mess right now.
Interesting! Better in terms of more quality preserved or smaller file size? Have you found other types of images where this applies?
I’ll just drop my AVIF local support for Wordpress plugin here: https://github.com/ddegner/avif-local-support
From my experience throwing random JPEGs at it, it's 3 to 4 times smaller, that's a good chunk of data saved, which in turn is a lot of energy saved on visitors' radios being active.
Unlike with jpeg, you don't need 85 or 95 percent on the quality score, 50 is more than good enough for most pictures on a website.
If you're hosting images and want a fully lossless encoding the CPU time may become a factor, but if you're hosting user generated content, I don't think it's all that bad. Plus, you can just move the encoding part to the user side of the equation and pretend it's part of the upload progress bar if you're desperate to pay the power bill.
Still, when encoding AVIF, there are various quality options to choose from, and the encoder has gotten better over the past year. On my i3-2120 NAS (which even your E5 should beat on single core perf), encoding an image at default speed takes about 4-6 seconds (JPEG about 2s), while producing an image of comparable quality a third the size. If I pass --speed 10, converting PNG to AVIF takes only half a second.
The standard AV1 encoder has improved a lot over a short amount of time, I invite you to run another benchmark, you may be surprised.
I don't know if anyone has published an encode time / quality comparison of the various encoders. It'd have to be recent to include this year's libaom image optimizations.
(I’m not saying I support the claims or not, I have no idea about their technical and let alone legal merit, just thinking that there are attempts at enforcement against sites streaming AV1 and whether choosing AV1 puts say my site at risk)
No need to worry about these risks for using it though. You can never say that no patent troll will surface tomorrow for literally anything. That's not a reason not to use things.
Well I guess you can use 20+ year old standards when they exist.
By contrast, if you let the user upload a JPEG or even a PNG, you might pay a slightly-higher cost of the incoming bandwidth, but then you (basically for free) transform the image to the small dimensions and format you actually need, and from there the bandwidth is barely a problem.
Sidenote: End users hate WEBP because nearly any software other than web browsers still don't support even reading it, let alone outputting it (and as you pointed out, anywhere that you "upload an image" they're not welcome either).
In my incredibly shoddy testing sample of 1, my current-macOS device does open AVIFs in Preview, so that's an improvement, at least!
https://symbiogenesis.github.io/DotJpegli/
However, video would matter so much more than images, to the overall internet, that images don't even matter by comparison.
Where AVIF isn’t supported, I reckon you’re better to fall back to JPEG. Everything supports JPEG, but there are still plenty of things that don’t support WebP. Anything that supports WebP now has indicated it’s open to supporting newer formats than the baseline JPEG/GIF/PNG and is almost certain to support AVIF within a few years.
Because whenever I download an image and its webp, the next thing i do is i google "webp to png/jpg" conversation because yeah service XY or Tool Z doesn't support it.
Or my Fire TV Stick :(
I configure my nginx to serve everything available though. Thats what i can do.
It's been a while since Photoshop finally got support, though, I can't recall the last time webp posed a problem for me. Then again I don't use a Firestick, no idea how that would deal with image formats, I guess it's no longer being maintained?
H265 for example. Or Dolby Vision.
JPEG XL vs. AVIF for web use-cases
https://news.ycombinator.com/item?id=50120224
In terms of picture quality for given size, AVIF has it solidly beat.
For arbitrary planes, AVIF calls them auxiliary images. Unless you mean encoding non-RGB data to start with like how DNG uses JPEG-XL. At which point you're outside the scope of any standard interpretation of JPEG-XL data.
I'm not sure this is the right conclusion to draw...
1) The author's pain point (use case) is hardware pricing - presuming that goes down (as either AI demands drops/and or production increases), this does not speak to a demand for size, instead, it is about doing more with less...
2) I'm not certain that the exabytes of demand (assuming it comes) will be from AVIF. Rather, if data is important, I think the demand will be a different format entirely (archives, for instance). Demand for more (quality) data might paradoxically call for less compression and less cpu-intensive qualities - uncompressed, raw data, for instance. If is faster and cheaper than bothering with complex algorithms, then simpler formats should be more prevalent.
Building on 1 and 2, a more capable image format, like JPEG-XL, becomes a more logical choice, not the one that can compress the best or is the smallest (in an exa-byte-as-the-norm world).
"We should use AVIF for most web images" is a different statement which I have no problem with.
Huh?
JpegXL is the only widely supported format (once it comes to the various browser as is planned) that can store true HDR linear images in floating point (fp16 and fp32) formats.
AVIF can only do 10 bit integer ranges, sure that HDR compared to 8bit but it is not sufficient for useful extended range color spaces.
Also AVIF supports up to 12 bits.
Just like you can assume most PNGs to be lossless (despite supporting pallettes, which pngquant uses to "compress" them) and non-animated (despite APNG being over 22 years old), you can assume most AVIF and WebP images are lossy. Same with JXL. HEIF requires a bit of special care (it's only produced by devices with HDR support so your pipeline needs to fit that) but that's pretty much it.
You may get surprised by an accidental, huge lossless AVIF/WebP/HEIF file, but most sources where you can even get these files are all lossy. Unless you recompress your photo library yourself, of course, but then you have full control over the entire process and can decide whether or not you want lossy or lossless.
Are you looking for jpeg XL?
> and do not leverage any existing infrastructure for serving video
How would that leveraging work?
> WebP, AVIF are the webscale equivalent of serving images.
This sounds insulting? But they are images on the Web. I have no idea what you mean here.
Odd argument.
Image isn’t video and we are not YouTube.
* https://gitlab.com/gitlab-org/gitlab/-/work_items/428012
* https://github.com/orgs/community/discussions/138164