-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is Gatsby-image supposed to serve larger images on mobile than on desktop? #8100
Comments
Hi @mixolydian251, for me it's giving a larger sized image for the desktop and smaller sized for the mobile. Please check the screenshots attached below. |
hmm interesting.. Which OS are you running? I am running Chrome on MacOS Sierra, and have a team member running a linux dist that has seen the same issue. Here is another live screenshot of the issue on my end. Looks like I am getting your desktop sizes on mobile, and smaller sizes on my desktop version? |
I'm on MacOS High Sierra. |
cc @pieh @m-allanson |
This is very probably because of Device Pixel Ratio. What happens in Firefox when you select a specific device? |
Yes, looks like DPR is causing the image size to scale up as the ratio increases. From what I am seeing mobile devices tend to have higher ratios. On my screen it looks like the pixel ration is close to 1. When simulating mobile DPR increases and changes when switching devices. Thus the increase in file size? @kakadiadarpan What device are you simulating in devtools? If you are using a retina display then simulating something with a lower DPR, could possibly be why we are getting different results? |
@mixolydian251 I have an MBP with a resolution of |
Hey y'all! 👋I wrote this last night while not really being awake anymore (and then forgot to post it ;-)), so take this with caution 🙏
FWIW, my gut says everything is working as expected 🤞 |
Just ran a Chrome Audit which mentioned a too large image on mobile (1280px)
Is this the best setting? |
Right! Didn't really checked srcSet, thanks for the hint and the link, the PR looks promising 👍 |
I would say it's better now thanks to #8825 🎉 |
Closing this issue as answered. If you need more help, please reach out to us! |
Summary
I was taking a peek at the images served using gatsby-image and noticed that images that are served to mobile are larger than the images served to the desktop browser. Is this a bug, or a limitation on mobile devices?
Relevant information
I first noticed this on my own site, but saw that the gatsby-image demo was producing the same issue.
Steps to reproduce
Environment (if relevant)
File contents (if changed)
gatsby-config.js
: N/Apackage.json
: N/Agatsby-node.js
: N/Agatsby-browser.js
: N/Agatsby-ssr.js
: N/AThe text was updated successfully, but these errors were encountered: