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
celine11mo 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
ἔρως
ἔρως11mo 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
celine11mo ago
if it's only one picture using something 3 partyish is surely too much
ἔρως
ἔρως11mo 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
celine11mo ago
Isn't that 2 errors for the same picture?
ἔρως
ἔρως11mo ago
no one is for ...-small.avif, the other for ...-large.avif
celine
celine11mo ago
oh, i see the title
ἔρως
ἔρως11mo 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
cmachdevOP11mo 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/[email protected] 1068w,
images/[email protected] 1068w,
images/[email protected] 1068w,
images/[email protected] 1602w,
images/[email protected] 1602w,
images/[email protected] 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/[email protected] 984w,
images/[email protected] 984w,
images/[email protected] 984w,
images/[email protected] 1422w,
images/[email protected] 1422w,
images/[email protected] 1422w">
<source srcset="images/all-business-small.avif 273w,
images/all-business-small.webp 273w,
images/all-business-small.jpg 273w,
images/[email protected] 546w,
images/[email protected] 546w,
images/[email protected] 546w,
images/[email protected] 819w,
images/[email protected] 819w,
images/[email protected] 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/[email protected] 1068w,
images/[email protected] 1068w,
images/[email protected] 1068w,
images/[email protected] 1602w,
images/[email protected] 1602w,
images/[email protected] 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/[email protected] 984w,
images/[email protected] 984w,
images/[email protected] 984w,
images/[email protected] 1422w,
images/[email protected] 1422w,
images/[email protected] 1422w">
<source srcset="images/all-business-small.avif 273w,
images/all-business-small.webp 273w,
images/all-business-small.jpg 273w,
images/[email protected] 546w,
images/[email protected] 546w,
images/[email protected] 546w,
images/[email protected] 819w,
images/[email protected] 819w,
images/[email protected] 819w">
<img src="images/all-business-small.jpg" width="273" height="224" alt="This cat is all business">
</picture>
ἔρως
ἔρως11mo 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
cmachdevOP11mo ago
Change
ἔρως
ἔρως11mo ago
have you tried to check the image size at multiple resolutions?
cmachdev
cmachdevOP11mo ago
Let me check
ἔρως
ἔρως11mo 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
vince11mo ago
All that error is saying is that your image size is too big / small compared to the rendered size
ἔρως
ἔρως11mo ago
yes, but have you seen the setup he has? it's a huge mess
vince
vince11mo ago
Nah I didn't
ἔρως
ἔρως11mo 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
cmachdevOP11mo ago
mobile 273 x 224, tablet 273 x 225 and desktop 273 x 325
ἔρως
ἔρως11mo 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
cmachdevOP11mo ago
done
ἔρως
ἔρως11mo ago
good now, just do those 2 images and that's all you need you can change your srcset to image.jpg, [email protected] 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
cmachdevOP11mo ago
Ok
Want results from more Discord servers?
Add your server