Image Optimization in nopCommerce: WebP, CDN & Lazy Loading

Performance 9 Updated

Image Optimization in nopCommerce: WebP, CDN & Lazy Loading

What nopCommerce 5.0 really does with WebP, how to size thumbnails, where lazy loading helps and hurts, and how to check that a CDN is caching your images.

The BSS store's plugin grid, whose 400-pixel WebP thumbnails come back from the CDN with a one-year cache, under the line right-sized WebP thumbnails, cached at the edge

Key takeaways

  • nopCommerce 5.00.1 saves each thumbnail in the format of the uploaded file: WebP stays WebP, PNG, GIF and BMP become PNG, and everything else becomes JPEG.
  • To serve WebP, upload WebP (or convert before upload). A JPEG upload never turns into WebP on its own.
  • Thumbnail sizes live in Configuration → Settings → Media settings, one per place an image appears. After changing image quality, delete the old thumbs.
  • The default product views set no loading, width or height. Add them in your theme, and keep the first visible image eager.

A category page feels quick on the office network. On a phone, the customer sees empty product cards while large photos arrive one by one. Usually the same heavy file is doing three jobs: the listing tile, the gallery and the zoom view.

This guide fixes that in the order that pays back first: measure, size the thumbnails, choose the format, load in the right order, then cache at the edge. We checked every platform detail against the nopCommerce 5.00.1 source and documentation on 25 November 2026.

Start With an Image Audit

A real nopCommerce category grid on the BSS store beside the five things to record for each image: format, bytes, rendered size, cache status and whether it is above the fold

Before you change a setting, find out which images cost the most. Test the home page, a busy category, search results, a product with several gallery images and the cart, on a phone profile as well as a desktop.

For each image, record five things in the browser's network panel: the format, the bytes transferred, the size it renders at, the cache status, and whether it sits above the fold. Those five tell you whether the problem is the source file, the thumbnail size, the loading order or the delivery.

Key fact: a thumbnail that renders at 300 pixels but downloads at 1,000 is a sizing problem, not a format problem. Fix sizes before you change formats.

If the whole store is slow, not only its images, work through the nopCommerce performance checklist after this audit.

Store too slow on mobile? BSS audits nopCommerce performance, images included, and fixes what it finds.

View nopCommerce services

Set Thumbnail Sizes in Media Settings

The official nopCommerce Media settings documentation for image quality and product image sizes, beside the MediaSettings class in the 5.00.1 source with one size per place an image appears

nopCommerce keeps its image controls in Configuration → Settings → Media settings. The official documentation lists where pictures are stored (database or file system), the maximum upload size, multiple thumb directories, the default image quality from 0 to 100, picture zoom and SVG uploads.

The sizes are set per place. The MediaSettings class in the 5.00.1 source has separate values for catalog thumbnails, the product detail image, thumbnails on the product page, category, manufacturer and vendor pictures, the cart, the mini cart and search autocomplete.

Setting in Media settings Where the image appears Size it from
Product thumbnail image size (catalog)Category and manufacturer gridsThe widest product card your theme renders
Product detail image sizeThe main picture on the product pageThe gallery's largest display width
Product thumbnail image size (product page)The gallery strip under the main pictureThe strip's thumbnail width
Cart/wishlist and mini-shopping cart sizesCart, wishlist and the mini cartThe small preview your theme shows

Changing quality is a deployment task

The Media settings documentation says that once you change the default image quality, you have to delete the already generated thumbs by hand. Back up first, try it on staging, and expect the first visits after the change to rebuild thumbnails.

From the BSS team

On our own store, the catalog grid asks for 400-pixel thumbnails, which you can see in the file names: each one ends in _400.webp. We sized it from the widest card the theme renders, not from a round number.

WebP in nopCommerce: What the Code Actually Does

The GetImageFormatByMimeType method in the nopCommerce 5.00.1 PictureService, which keeps WebP as WebP, turns PNG, GIF and BMP into PNG and everything else into JPEG, with the line that encodes thumbnails at the default image quality

This is where most guides are vague, so we read the source. In nopCommerce 5.00.1, PictureService picks the thumbnail format from the uploaded file's MIME type: WebP is encoded as WebP; PNG, GIF, BMP and icons as PNG; everything else, JPEG included, as JPEG.

So nopCommerce serves WebP when you upload WebP. A JPEG product photo produces JPEG thumbnails, however many times they are regenerated. There is no setting in Media settings that converts formats.

switch (lastPart)
{
    case "webp":
        format = SKEncodedImageFormat.Webp;
        break;
    case "png":
    case "gif":
    case "bmp":
    case "x-icon":
        format = SKEncodedImageFormat.Png;
        break;
}
// thumbnails are encoded at the Media settings quality, or 80 when it is 0
return cropImage.Encode(format, _mediaSettings.DefaultImageQuality > 0 ? _mediaSettings.DefaultImageQuality : 80).ToArray();

That leaves three practical routes: convert product photos to WebP before upload, convert them in an import script, or let an image CDN convert on the way out. Whichever you pick, keep a high-quality master outside the store, and check that feeds, emails and social previews still accept the files they receive.

From the BSS team

Every image on this blog is uploaded as WebP, with an 800-pixel copy for phones. nopCommerce then keeps WebP for every thumbnail it generates, so no plugin is needed for the format.

Lazy-Load Below the Fold, and Give Every Image a Size

web.dev's guidance to eager-load images in the first viewport and to give every image width and height, beside the default nopCommerce 5.00.1 product picture markup, which sets neither

The loading="lazy" attribute lets the browser wait to fetch an image until it nears the viewport. It suits product cards further down a category, related products and long review blocks. It does not suit the first image a shopper sees.

web.dev's guidance is direct: eager-load the images visible in the first viewport, especially the LCP image, and use lazy loading only outside it. The same guide recommends width and height on every image, so the browser can reserve the space and the page does not jump.

The default 5.00.1 views leave both to your theme. The product box and product page pictures are plain <img alt src title> tags, so a theme override is where they belong.

<img alt="@picture.AlternateText" src="@picture.ImageUrl" title="@picture.Title"
     width="400" height="400" loading="lazy" decoding="async" />

Set the width and height to your catalog thumbnail size. On the product page, keep the main picture eager, and consider fetchpriority="high" on it.

A BSS theme that does this already
NopGadget Theme + 18 Plugin Bundle

On its live demo's home page, 247 of 280 images carry loading="lazy" and 188 are WebP (checked 25 November 2026).

Put a CDN in Front, Then Roll Out and Test

A terminal with the real response headers of a BSS store thumbnail, served as image/webp with a one-year cache and a CDN cache hit, over the store's plugin grid

Media settings has no CDN field. A CDN sits in front of the store instead: a proxy on your own hostname, or a separate media host. It caches the files under /images/thumbs/ close to your shoppers and takes the repeat traffic off the application server.

One request tells you whether it works. Our store's thumbnails come back as image/webp, with Cache-Control: public, max-age=31536000 and a cache HIT from the edge. A cache that long needs a plan for replaced pictures: purge the edge copy when a product image changes, or shoppers keep seeing the old one.

Roll out in this order

  • Back up the media and record the current Media settings, so you can roll back.
  • Measure the five facts on a home page, a category, a product page and the cart.
  • Set the thumbnail sizes from the theme's real layout.
  • Convert the product photos you upload next to WebP, and spot-check textures, edges and transparency.
  • Add width, height and lazy loading in the theme; keep the first visible image eager.
  • Put the CDN in front and confirm the image response headers with one request.
  • Delete the old thumbs if you changed quality, warm the busiest pages, then measure again.

Then test the things that break quietly: replacing a product image must refresh its thumbnails at the edge, and multi-store domains, feeds, emails and social previews must still load their images. If image work is part of a wider memory problem, our high memory usage guide separates the two.

Frequently Asked Questions

Does nopCommerce support WebP images?
Yes. nopCommerce 5.00.1 accepts WebP uploads and keeps WebP for every thumbnail it generates from them, served with the image/webp content type.
Does nopCommerce convert JPEG images to WebP automatically?
No. Thumbnails keep the format of the uploaded file, so a JPEG upload produces JPEG thumbnails. Convert to WebP before upload, in an import script, or with an image CDN.
Where do I change image sizes in nopCommerce?
In Configuration → Settings → Media settings. There is a separate size for catalog thumbnails, the product detail image, product page thumbnails, category, manufacturer and vendor pictures, the cart and the mini cart.
Should I lazy-load the main product image?
No. Keep the first visible image, usually the main product picture, eager. Lazy-load images further down the page, such as later product cards and related products.
Does nopCommerce have a CDN setting?
Media settings has no CDN field. Put a CDN or caching proxy in front of the store, then check one thumbnail's response headers for the content type, the cache lifetime and a cache hit.

Final Thoughts

The slow phone category page from the opening rarely needs one big fix. It needs thumbnails sized to the theme, WebP files uploaded as WebP, the first image loaded eagerly and the rest lazily, and a cache in front that a single request can verify.

Measure before and after each step, and keep the rollback path. If you want a second pair of eyes, our caching guide covers the server side of the same problem.

MH

Written by Moumita Hossain

Software Engineer · Bangladesh Software Solution

Software Engineer at BSS in Dhaka, building backend systems in JavaScript and TypeScript.

Read nextPerformance nopCommerce Performance Optimization: The Complete Checklist 15 min read