How to Improve Speed Up Image Loading on Your Shopify Store

Sell Online With Shopify
Trusted by millions of businesses worldwide
Start your Shopify 14-day free trial and save up to 25% on Shopify when you sign up for an annual, 2-year, or 3-year plan.

When it comes to selling online, there are a few key factors that can have a big impact on your store’s conversion rate. One of these key factors is web page speed loading. And the length of time it takes for images to load is one of the primary reasons why your website is so sluggish. In this blog article, we will demonstrate how you may use some straightforward recommendations to expedite the loading of images on your Shopify site. Let’s get started!

The following is a list of numerous different methods that may assist you in optimizing images:

1. Don’t retrieve images of excessively high resolution

Although image size isn’t directly related to one of the key components of a performance score, it may significantly affect a website’s performance if photos aren’t generated at the proper size.

For illustration purposes, below is the code that displays your image:

If you run the above code, you’ll get an image with a width be 1024px. This is a size indicative of a huge image so the size of the data being represented is likewise rather large. You have the option of changing this size to a lesser number. This results in a size reduction that is rather noticeable.

2. Show proper-size images for the device it is being viewed on

The src-set and sizes method help shows an image in a manner that is appropriate for the device it is being viewed on. Take, for instance, the banner above the homepage or the primary product picture. The src-set and sizes properties provide you the ability to specify in much more depth and with greater control what picture should be shown at various viewport widths.

As a result, in order to accommodate the responsive nature of the storefront and the various sizes in which your product images may be rendered, let’s provide the browser with a variety of image sizes and rules for how to output these images.

To begin, I will provide you src-set with the primary product picture, which is as follows:

This gives the browser access to a series of photos and gives it information about the sizes of those images.

The next step is to provide some recommendations to the browser on the appropriate picture size to use and when to use it.

{{ settings.page_width }} is a global parameter, which controls the maximum page width for desktop devices. Using a combination of this setting’s value and some math applied to the Viewport Width (vw) value you are able to provide the optimum image size for different viewports.

3. Use lazy loading to improve the image loading speed

Google Lighthouse also identified an opportunity to defer the offscreen images. Normally, all of the images will be loaded, regardless of whether or not the user can see them in their viewport.

This functionality is already automatically supported by Shopify; all you need to do is add the loading="lazy" attribute to any image tags on your site.

Read more: How to easily add lazy loading for images in Shopify, The best Shopify Lazy Load apps to make your online store faster.

4. Set size attributes for image tags

Cumulative Layout Shift (CLS) measures the greatest bursts of all unexpected layout alterations that take place over the course of a page’s lifetime. A layout shift happens whenever a visible element moves from one displayed frame to the next. While loading material into the website via JavaScript is a common source of this, pictures loaded without the proper size attributes set may also be the culprit.

The disadvantage of the lazy-load technique you just used for your photos is that it may also have an influence on the Cumulative Layout Shift (CLS), even though material loaded through JavaScript is the main cause of low CLS scores. You may provide width and height properties to the image in order to inform the browser how much room to allocate for these images and to reduce the possibility of CLS, which might occur while an image is being loaded.

To take use of this advice, apply the code shown in the following paragraph to the image tags:

Conclusion

I demonstrated how you may use some straightforward recommendations to expedite the loading of images on your Shopify site. After reading this article, I hope that you will be able to optimize the speed of your website and understand how to improve the time it takes to load images. Still, have questions? Let me hear them in the comments!

Need Help Setting Up Or Customizing Your Shopify Theme?

You may also like...

Leave a Reply

Your email address will not be published.