> I don’t think there’s a perfect answer. You simply cannot predict with 100% certainty what the browser would choose. But you can get a good approximation by parsing the User-Agent header Isn't it the purpose of the "Accept" HTTP header? For example the last version of Firefox sends "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp, / ;q=0.8" when fetching a page.
I've been surprised lately by the number of people that don't know about or understand HTTP headers. One discussion I saw was on a project that was trying to decide what language to serve a webpage in. They spent a good amount of time choosing a geo-location provider and library and then deciding what language to default to for locations that often had multiple languages. I asked why they didn't just use the Accept-L…
Optimizing images with the HTML tag
21–30 of 52 posts
Re: Optimizing images with the HTML <picture> tag
#22A significant downside to the element, and alternative image formats in general, is that when most users wanna download the image they expect an image format they already know how to work with. To most users an .avif or .webp are an annoyance because they reasonable expect most of their tools to be unable to open these. It's disappointing that browser vendors haven't picked up on this and offered a "Save as PNG/JPEG/…
Couldn't one do the same thing to make users get jpegs when they try to save a wepb? How bad would it be?
Re: Optimizing images with the HTML <picture> tag
#23I am using the picture tag on my photography blog [1] to serve optimized images for a range of breakpoints. I also used to serve WEBP versions of the photos but noticed that (in my audience) the browser support was sufficiently low to drop the generation step for them and just serve various size/quality combinations of JPG. If time allows, I’ll also add a super low-res placeholder image in the background to prevent t…
Re: Optimizing images with the HTML <picture> tag
#24> I don’t think there’s a perfect answer. You simply cannot predict with 100% certainty what the browser would choose. But you can get a good approximation by parsing the User-Agent header Isn't it the purpose of the "Accept" HTTP header? For example the last version of Firefox sends "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp, / ;q=0.8" when fetching a page.
I've been surprised lately by the number of people that don't know about or understand HTTP headers. One discussion I saw was on a project that was trying to decide what language to serve a webpage in. They spent a good amount of time choosing a geo-location provider and library and then deciding what language to default to for locations that often had multiple languages. I asked why they didn't just use the Accept-L…
Re: Optimizing images with the HTML <picture> tag
#25A significant downside to the element, and alternative image formats in general, is that when most users wanna download the image they expect an image format they already know how to work with. To most users an .avif or .webp are an annoyance because they reasonable expect most of their tools to be unable to open these. It's disappointing that browser vendors haven't picked up on this and offered a "Save as PNG/JPEG/…
Certainly not the case with WebP, which was announced by Google 12 years ago. On a recent version of macOS, Preview, the Mac’s default image and pdf viewer can open WebP and AVIF files, making it easy for Mac users to convert to another format if they wish. Also 3rd party graphics apps have supported WebP for years now.
AVIF support isn’t as widespread yet but that will quickly change now.
BTW, the iOS defaults to saving photographs in HEIC, which the average consumer has never heard of.
Re: Optimizing images with the HTML <picture> tag
#26> I don’t think there’s a perfect answer. You simply cannot predict with 100% certainty what the browser would choose. But you can get a good approximation by parsing the User-Agent header Isn't it the purpose of the "Accept" HTTP header? For example the last version of Firefox sends "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp, / ;q=0.8" when fetching a page.
I've been surprised lately by the number of people that don't know about or understand HTTP headers. One discussion I saw was on a project that was trying to decide what language to serve a webpage in. They spent a good amount of time choosing a geo-location provider and library and then deciding what language to default to for locations that often had multiple languages. I asked why they didn't just use the Accept-L…
Re: Optimizing images with the HTML <picture> tag
#27One caution here, as I'm just recently was working on automated image encoding for user submitted images - be careful of AVIF/JXL's encoding time. I ran some benchmarks with a raw 48mp iPhone 14 dng file (converted to png to start with since jxl had issues going from dng directly) with imagemagick to illustrate. jpg conversion: 1.74s webp conversion: 3.77s avif conversion: 67.96s jxl conversion: 42.74s Of course ther…
Holy shit-balls? Also I thought that quad bayer would come down to 12MP for the output?
Re: Optimizing images with the HTML <picture> tag
#28This could also conceivably be used for user tracking purposes as a way to determine without javascript the user's browser window setting. (I assume CSS can do this too.)
Re: Optimizing images with the HTML <picture> tag
#29One caution here, as I'm just recently was working on automated image encoding for user submitted images - be careful of AVIF/JXL's encoding time. I ran some benchmarks with a raw 48mp iPhone 14 dng file (converted to png to start with since jxl had issues going from dng directly) with imagemagick to illustrate. jpg conversion: 1.74s webp conversion: 3.77s avif conversion: 67.96s jxl conversion: 42.74s Of course ther…
Re: Optimizing images with the HTML <picture> tag
#30For me the biggest win in pages with lots of images is the img loading=lazy flag- https://developer.mozilla.org/en-US/docs/Web/Performance/Laz... This only loads the image when it scrolls into view