In digital commerce, visual appeal is everything. Online shoppers rely heavily on product images when making purchase decisions and depend on high-quality visuals to evaluate product details, compare options, and build trust in a brand.
Why do images matter in digital commerce?
- Increase conversions: a well-optimized image can increase sales.
- Reduce returns: clear product visuals help set accurate expectations, decreasing return rates.
- Strengthen brand identity: consistent and high-quality imagery enhances brand recognition.
- Boost engagement: interactive media keep customers engaged longer.
The following sections clarify the differences between Images and Assets and the scenarios where you should use each option.
Images
- Purpose: represent product visuals directly on product pages and listings.
- Storage and delivery: uploaded images are stored on a Content Delivery Network (CDN), ensuring fast loading times globally.
- Limitations: no sharing between Product Variants. Implement this logic in your application, if required.
- External hosting: you can link to images hosted externally by providing their URLs.
Assets
Assets provide a more flexible approach for handling various types of media, beyond just product images.
- Purpose: manage multiple types of media (such as images, videos, and PDFs) associated with Products, Categories, or other resources.
- Flexibility:
- Multiple sources: an Asset can have different formats and resolutions (for example, video encodings and image sizes).
- Rich metadata: you can use
name,description, andtagsfor organization and filtering purposes. - Custom Fields: store additional information specific to your needs.
- Use cases:
- Product manuals (PDFs)
- Localized videos
- Multiple image resolutions for different contexts
- 360-degree product views
- Various video encodings for compatibility
- External hosting: you can add links to images hosted externally by providing their URLs.
Key differences at a glance
| Feature | Image | Asset |
|---|---|---|
| Purpose | Product-specific visuals | General media management |
| File Types | Images only | Images, videos, PDFs, and more |
| Metadata | Limited (URL, label) | Rich metadata (name, description, tags, and custom fields) |
| Organization | Tied to Product Variants | Flexible; can be linked to Product Variants and Categories |
| Source options | Single source | Multiple sources for different formats, resolutions, and encodings |
| Use cases | Product displays | Product manuals, localized content, 360° views, high-resolution downloads, and any scenario that requires diverse media with detailed metadata and flexible management |
Choose between Images and Assets
While Images are suitable for basic product visuals, Assets are generally the preferred method to manage media content. The flexibility, rich metadata, and support for multiple file types make Assets a powerful tool for creating engaging and informative product experiences.
If you need to manage anything other than simple product images or if you require detailed metadata and flexible organization, Assets are the way to go.
Working with Assets
Add an Asset
addAsset update action. The following example adds a PDF product manual:POST /{projectKey}/products/<product-id> with:{
"version": 1,
"actions": [{
"action": "addAsset",
"variantId": 1,
"asset": {
"sources": [
{
"uri": "https://example.org/content/product-manual.pdf",
"contentType": "application/pdf"
}
],
"name": { "en" : "Product Manual" },
"description": { "en" : "The manual for my product." },
"tags": ["manual", "pdf"]
}
}]
}
name and description fields provide human-readable metadata. The tags and optional contentType on the source let your frontend decide how to display the Asset. For example, a product details page could search for all Assets tagged as manual and use the contentType to render a PDF viewer or a video player.Use Asset Sources for multiple formats
key, dimensions, and contentType so your frontend can select the optimal format.Asset Sources for different resolutions
In this example, a product image is available as a thumbnail, a regular-resolution version, and a high-resolution zoom version:
{
"assetId": "<id>",
"name": { "en" : "My Product Image" },
"sources": [
{
"uri": "https://example.org/product-full.jpg",
"dimensions": {"w": 600, "h": 400},
"key": "full"
},
{
"uri": "https://example.org/product-thumb.jpg",
"dimensions": {"w": 90, "h": 60},
"key": "thumb"
},
{
"uri": "https://example.org/product-zoom.jpg",
"dimensions": {"w": 3000, "h": 2000},
"key": "zoom"
}
]
}
key to find a specific source (for example, "thumb") or compare dimensions to choose the best resolution for the current display. You can also use the dimensions field to generate the HTML srcset attribute for responsive images:<img
src="https://example.org/product-full.jpg"
srcset="
https://example.org/product-thumb.jpg 90w,
https://example.org/product-full.jpg 600w,
https://example.org/product-zoom.jpg 3000w
"
/>
Asset Sources for different video encodings
When a product video is encoded in multiple formats (for example, MP4, WebM, and HTTP Live Streaming (HLS)), each encoding is stored as a separate source:
{
"assetId": "<id>",
"name": { "en": "My Product Video" },
"sources": [
{
"uri": "https://example.org/product-video.mp4",
"key": "mp4",
"contentType": "video/mp4"
},
{
"uri": "https://example.org/product-video.webm",
"key": "webm",
"contentType": "video/webm"
},
{
"uri": "https://example.org/product-video.m3u8",
"key": "hls",
"contentType": "application/x-mpegURL"
},
{
"uri": "https://example.org/product-video-thumb.jpg",
"key": "thumb",
"contentType": "image/jpeg"
}
]
}
<video> element supports multiple sources and the browser picks the most suitable one:<video controls poster="https://example.org/product-video-thumb.jpg">
<source src="https://example.org/product-video.mp4" type="video/mp4" />
<source src="https://example.org/product-video.webm" type="video/webm" />
<source
src="https://example.org/product-video.m3u8"
type="application/x-mpegURL"
/>
</video>
Product Tailoring
Key takeaways
- Images are CDN-hosted visuals tied to Product Variants. They are simple to set up but limited to image files with minimal metadata.
- Assets support any media type (images, videos, PDFs) with rich metadata, tags, and multiple sources per Asset.
- Use tags to organize Assets by language, aspect ratio, 360-degree sequences, or any custom classification your frontend needs.
- Use Asset Sources to deliver the same Asset in multiple formats or resolutions, enabling responsive images (
srcset) and adaptive video (<video>with multiple<source>elements). - Prefer Assets over Images when you need metadata, multi-format delivery, or non-image media.
Test your knowledge
Where to next?
Great job at finishing the Images and Assets module! That brings us to the end of the Model your product catalog learning path. If you haven't yet completed our other functional learning paths, we strongly recommend that you complete them next. Click one of the cards below to get started. Good luck!
Model your business structure
Learn how to translate your unique business structure into commercetools, creating flexible and scalable solutions tailored to the needs of your organization.
6 hours
Price and discount your products
Learn to design and implement effective pricing and discount strategies, leveraging key features such as price scopes, product discounts, and cart discounts.
7 hours