AVIF and WebP

In B2C Commerce, load AVIF and WebP for smaller file sizes with modern browsers, and use JPEG (or PNG for lossless output or transparency) as a fallback.

Which Salesforce Commerce Product Do I Have?

Output formats, quality, and the URLUtils and MediaFile rules are in Dynamic Imaging Service. The Supported Transformations table has the full format, extension, and quality details. This page describes when to use each format in markup and how picture and source elements reference Dynamic Imaging Service URLs.

Which Image Format Should I Use? 

In B2C Commerce, use these formats for storefront images.

FormatTypical useNotes
AVIFHigh-compression product photography when the browser supports itOften the smallest. Support depends on the shopper browser and version.
WebPBalanced size and support for modern clientsWider support than AVIF. Still not universal on very old clients.
JPEG / PNGDefault, img fallbacks, or transparency through PNGAlign file extension in the URL with the format that you need.

How Do I Use the Picture Element? 

In B2C Commerce, offer AVIF or WebP first, then a baseline image. The Dynamic Imaging Service URLs, including extensions and sfrm values, must follow Supported Transformations and your URLUtils or MediaFile calls. Example (Internet Store Markup Language (ISML)-agnostic) pattern:

1<picture>
2  <source srcset="<your AVIF DIS URL>" type="image/avif" />
3  <source srcset="<your WebP DIS URL>" type="image/webp" />
4  <img src="<your JPEG DIS URL>" alt="..." />
5</picture>

Generate each URL in script from the same view type or path, with format or a file extension and a transform object. Don’t hard-code sw= strings in your HTML.

Performance and Cache Hygiene 

In B2C Commerce, keep transformation parameters stable and minimized. Identical logical sizes and parameters map to a single cache key, which can improve hit rates at the CDN. See What Limits and Caching Rules Apply? and Dynamic Imaging Caching.

  • Omit q=80 when 80 is already the default in your usage, so the string doesn’t carry an unnecessary q.
  • Monitor image weight and 4xx rates. Spikes often correlate with a bad oimg value, invalid sw= / sh= pairs, or an overlay URL that isn’t URL-encoded. See Troubleshooting and Migration.

See Also