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.
In B2C Commerce, use these formats for storefront images.
| Format | Typical use | Notes |
|---|---|---|
| AVIF | High-compression product photography when the browser supports it | Often the smallest. Support depends on the shopper browser and version. |
| WebP | Balanced size and support for modern clients | Wider support than AVIF. Still not universal on very old clients. |
| JPEG / PNG | Default, img fallbacks, or transparency through PNG | Align file extension in the URL with the format that you need. |
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:
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.
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=80when 80 is already the default in your usage, so the string doesn’t carry an unnecessaryq. - Monitor image weight and 4xx rates. Spikes often correlate with a bad
oimgvalue, invalidsw=/sh=pairs, or an overlay URL that isn’t URL-encoded. See Troubleshooting and Migration.