Issue with img sizing in lighthouse

Does anyone know how to fix this? When I remove the higher resolution images for the DPI I get this.
No description
No description
23 Replies
celine
celine2y ago
hmm, maybe try to use something like twicpics to optimize your images? I think its features will solve your problem. https://www.twicpics.com/
TwicPics
TwicPics
Responsive Images as a Service
ἔρως
ἔρως2y ago
before you do anything, stop if your design is responsive, and the image changes sizes, try to check how big/small it is, and all it's sizes honestly, i wouldn't do a whole lot with the images you already have
celine
celine2y ago
if it's only one picture using something 3 partyish is surely too much
ἔρως
ἔρως2y ago
he already has 2 images of 2 different sizes he probably just doesn't have it setup properly for example, it's complaining about the pixel size of the image maybe using min-resolution: 2dppx to load the large image for retina displays will clear the first error and the 2nd one, maybe he's loading the large image when he should be loading the small image
celine
celine2y ago
Isn't that 2 errors for the same picture?
ἔρως
ἔρως2y ago
no one is for ...-small.avif, the other for ...-large.avif
celine
celine2y ago
oh, i see the title
ἔρως
ἔρως2y ago
yes i think it's all just bad setup probably bad media queries or bad srcset we need more to check it better ourselves anyways
cmachdev
cmachdevOP2y ago
<picture>
<source media="(min-width: 960px)"
srcset="images/all-business-large.avif 534w,
images/all-business-large.webp 534w,
images/all-business-large.jpg 534w,
images/all-business-large@2x.avif 1068w,
images/all-business-large@2x.webp 1068w,
images/all-business-large@2x.jpg 1068w,
images/all-business-large@3x.avif 1602w,
images/all-business-large@3x.webp 1602w,
images/all-business-large@3x.jpg 1602w"
sizes="534px">
<source media="(min-width: 600px)"
srcset="images/all-business-medium.avif 474w,
images/all-business-medium.webp 474w,
images/all-business-medium.jpg 474w,
images/all-business-medium@2x.avif 984w,
images/all-business-medium@2x.webp 984w,
images/all-business-medium@2x.jpg 984w,
images/all-business-medium@3x.avif 1422w,
images/all-business-medium@3x.webp 1422w,
images/all-business-medium@3x.jpg 1422w">
<source srcset="images/all-business-small.avif 273w,
images/all-business-small.webp 273w,
images/all-business-small.jpg 273w,
images/all-business-small@2x.avif 546w,
images/all-business-small@2x.webp 546w,
images/all-business-small@2x.jpg 546w,
images/all-business-small@3x.avif 819w,
images/all-business-small@3x.webp 819w,
images/all-business-small@3x.jpg 819w">
<img src="images/all-business-small.jpg" width="273" height="224" alt="This cat is all business">
</picture>
<picture>
<source media="(min-width: 960px)"
srcset="images/all-business-large.avif 534w,
images/all-business-large.webp 534w,
images/all-business-large.jpg 534w,
images/all-business-large@2x.avif 1068w,
images/all-business-large@2x.webp 1068w,
images/all-business-large@2x.jpg 1068w,
images/all-business-large@3x.avif 1602w,
images/all-business-large@3x.webp 1602w,
images/all-business-large@3x.jpg 1602w"
sizes="534px">
<source media="(min-width: 600px)"
srcset="images/all-business-medium.avif 474w,
images/all-business-medium.webp 474w,
images/all-business-medium.jpg 474w,
images/all-business-medium@2x.avif 984w,
images/all-business-medium@2x.webp 984w,
images/all-business-medium@2x.jpg 984w,
images/all-business-medium@3x.avif 1422w,
images/all-business-medium@3x.webp 1422w,
images/all-business-medium@3x.jpg 1422w">
<source srcset="images/all-business-small.avif 273w,
images/all-business-small.webp 273w,
images/all-business-small.jpg 273w,
images/all-business-small@2x.avif 546w,
images/all-business-small@2x.webp 546w,
images/all-business-small@2x.jpg 546w,
images/all-business-small@3x.avif 819w,
images/all-business-small@3x.webp 819w,
images/all-business-small@3x.jpg 819w">
<img src="images/all-business-small.jpg" width="273" height="224" alt="This cat is all business">
</picture>
ἔρως
ἔρως2y ago
that's ... you really went overboard perhaps you have too many images and resolutions 474 and 546 are so close that it makes it worthless to have that difference there 1068w 984w 819w just basically the same what's the size of the image on the page, when you show it? does it even change? i think you went about this in a way to appease the almighty lighthouse results, instead of checking what's going on with the image yourself
cmachdev
cmachdevOP2y ago
Change
ἔρως
ἔρως2y ago
have you tried to check the image size at multiple resolutions?
cmachdev
cmachdevOP2y ago
Let me check
ἔρως
ἔρως2y ago
here's something you can try you can check for an onresize event of the window then, send to the console the actual width and height of the image element and also send the width and height of the window something like: window: 1920x1080 - image: 300x500 then you can see the sizes of the image and just start with the maximum resolution of your page down to the lowest
vince
vince2y ago
All that error is saying is that your image size is too big / small compared to the rendered size
ἔρως
ἔρως2y ago
yes, but have you seen the setup he has? it's a huge mess
vince
vince2y ago
Nah I didn't
ἔρως
ἔρως2y ago
this is a mess there's lots of resolutions that are 200-300px apart also, im telling him to check if all those sizes are actually necessary, and the proper sizes for the images
cmachdev
cmachdevOP2y ago
mobile 273 x 224, tablet 273 x 225 and desktop 273 x 325
ἔρως
ἔρως2y ago
just make a 273x325px image and done use that one you can include a 2x version, but that's it by the way, don't hard-code the height in css reset it to "auto"
cmachdev
cmachdevOP2y ago
done
ἔρως
ἔρως2y ago
good now, just do those 2 images and that's all you need you can change your srcset to image.jpg, image@2x.jpg 2x by the way, don't bother with the webp version, in my opinion just jpeg and avif you can use webp if you want to anyways by the way, if you want to make your 2x images, consider also using jpegxl
cmachdev
cmachdevOP2y ago
Ok

Did you find this page helpful?