Loading
Get Started with B2C Commerce
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Image Transformation URL Structure, Validation, and Order of Operations

          Image Transformation URL Structure, Validation, and Order of Operations

          Image transformation requests use a /dw/image/v2/ path and query string. The B2C Commerce Dynamic Imaging Service applies those parameters in a fixed order.

          For transform types, parameter names, JavaScript transform objects, and validation details, use the Supported Transformations table. This topic only explains path shape, order of operations, and how output format relates to the URL.

          Path marker

          Transformed image URLs use the path segment /dw/image/v2/ with the usual static content path (for example, on/demandware.static/...). Build URLs with the URLUtils and MediaFile classes in Dynamic Imaging Service , as in the hub Related Dynamic Imaging Service Topics .

          Output format and file extension

          The file extension in the generated URL (for example, .webp or .avif) selects the output format. The sfrm parameter, where needed, can specify the source image format. See the Format row in Supported Transformations .

          Order of operations

          When multiple transform types apply to a single request, the Dynamic Imaging Service processes them in the following order. If you combine crop and scale, plan the crop on the original source image, because the service applies the crop first and then scales the result, not the other way around.

          1. Format (when specified)
          2. Background color ( bgcolor), to flatten transparency where used
          3. Crop ( cx, cy, cw, ch)
          4. Resize / scale mode ( sw, sh, sm)
          5. Overlay ( ox, oy, oimg)
          6. Quality ( q)
          7. Metadata strip ( strip)

          Parameter validation rules (quick reference)

          The service rejects requests with invalid parameters and returns 400 Bad Request. For the full rules see the Supported Transformations table.

          Parameter Rule Required
          sw, sh Integer, 10 to 3000 pixels. Cannot be empty when present. No
          sm cut (default) or fit. Use only with sw and sh. No
          cx, cy Integer, 0 or greater. All four crop parameters required together. With crop
          cw, ch Integer, 10 or greater. All four crop parameters required together. With crop
          ox, oy Integer, 0 or greater. All three overlay parameters required together. With overlay
          oimg URL-encoded path to a customer-owned image on the Dynamic Imaging Service domain. Maximum 400 characters. Supported formats: GIF, PNG, JPG, JP2. With overlay
          bgcolor 6-digit hex (opaque) or 8-digit hex (alpha, PNG output only). No
          q Integer, 1 to 100. Default 80 for JPG/JP2. Omit when using the default. No
          sfrm Source format: gif, jp2, jpg, jpeg, png, tiff, or tif. No
          strip true (default) strips metadata; false preserves it. No

          Common causes of a 400 response

          • Duplicate parameters in the same URL (?sw=100&sw=200). Last value wins, which can mask logic errors.
          • Empty values (?sw=&sh=400).
          • Wrong delimiter, usually a stray % instead of &.
          • Unencoded spaces or other reserved characters in an overlay URL.
          • Incomplete crop or overlay parameter sets.
          • Values outside the ranges above (for example, sw=5).

          For file size, timeout, Image Guidelines, and Dynamic Imaging Caching, see Dynamic Imaging Service . For Troubleshooting and migration , use that topic.

           
          Loading
          Salesforce Help | Article