Skip to content

Image file size optimizations #65482

Closed Answered by williamhaley
williamhaley asked this question in Help
Discussion options

You must be logged in to vote

I think I see what I'm missing here. I glossed over the documentation for sizes on the Image component, and I'm finding this prop plays a bigger role than I realized.

I assumed that prop had more to do with responsive sizing after an image was already pulled down from the image server, but I see now it impacts what image is pulled down in the first place (emphasis mine).

First, the value of sizes is used by the browser to determine which size of the image to download, from next/image's automatically generated srcset. When the browser chooses, it does not yet know the size of the image on the page, so it selects an image that is the same size or larger than the viewport. The sizes propert…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by williamhaley
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant