@MikeGraphicThat ,
The Opportunities section of your Lighthouse report lists all images in your page that aren’t appropriately sized, along with the potential savings in kibibytes (KiB). Resize these images to save data and improve page load time
For each image on the page, Lighthouse compares the size of the rendered image against the size of the actual image. The rendered size also accounts for device pixel ratio. If the rendered size is at least 4KiB smaller than the actual size, then the image fails the audit.
Specify multiple image versions and the browser will choose the best one to use:
For Example:
Before
|
![]()
|
After
|
![]()
|
The
tag’s src, srcset, and sizes attributes all interact to achieve this end result.
Shopify Image Proper Size Solution:
A)
<img class=“grid-product__image lazyload”
data-src=“{{ img_url }}”
data-srcset=“{{ img_url }}”
data-widths=“[180, 360, 540]”
data-aspectratio=“{{ preview_image.aspect_ratio }}”
data-sizes=“auto”
alt=“{{ preview_image.alt | escape }}”
srcset=“data:image/svg+xml;utf8,<svg%20xmlns=‘http://www.w3.org/2000/svg’%20width=’{{ preview_image.width }}‘%20height=’{{ preview_image.height }}'>”
height=“{{preview_image.height}}”
width=“{{preview_image.width}}”>
B)
{% capture image_100x %}{{ media.preview_image | img_url: ‘100x’ }}{% endcapture %}
{% capture image_200x %}{{ media.preview_image | img_url: ‘200x’ }}{% endcapture %}
{% capture image_300x %}{{ media.preview_image | img_url: ‘300x’ }}{% endcapture %}
{% capture image_400x %}{{ media.preview_image | img_url: ‘400x’ }}{% endcapture %}
{% capture image_600x %}{{ media.preview_image | img_url: ‘600x’ }}{% endcapture %}
<img class=“lazyload”
src=“data:image/svg+xml;utf8,<svg%20xmlns=‘http://www.w3.org/2000/svg’%20width=’{{ preview_image.width }}‘%20height=’{{ preview_image.height }}'>”
data-src=“{{ image_100x | img_url: ‘100x’ }} 100w”
data-srcset="{{ image_100x }} 100w,
{{ image_200x }} 200w,
{{ image_300x }} 300w,
{{ image_400x }} 400w"
width=“{{preview_image.width}}”
height=“{{preview_image.height}}”
alt=“{{ preview_image.alt }}”>