Search Docs
Loading...
Skip to content

To WebP

Export designs to WebP format for optimized web delivery with smaller file sizes than PNG or JPEG.

Export to WebP showing the editor with export options

5 mins
estimated time
Download
StackBlitz
GitHub

WebP delivers smaller file sizes than PNG and JPEG while preserving image quality and transparency support.

This guide covers exporting to WebP, configuring quality settings, and triggering downloads.

Export to WebP#

Call engine.block.export() with mimeType: 'image/webp' and a webpQuality value between 0 and 1.

// Export with lossy compression
const blob = await engine.block.export(p, {
mimeType: 'image/webp',
webpQuality: 0.8
});

The webpQuality parameter controls compression. A value of 0.8 provides a good balance between file size and visual quality for most use cases.

Export Options#

WebP export supports these options:

Option Type Description
mimeType 'image/webp' Required. Specifies WebP format
webpQuality number Quality from 0 to 1. Default 1.0 (lossless)
targetWidth number Optional resize width
targetHeight number Optional resize height
outputProfileMode string What the export does with the document’s Output RGB profile. 'Off' (default) ignores it. 'Convert' converts the pixels into it, and writes the profile only with embedProfiles. 'Assign' keeps the pixels and writes the profile into the file, also without embedProfiles. See Color Basics.
embedProfiles boolean Write an ICC profile into the file: the Output RGB profile under 'Convert' or 'Assign', else the profile of the working space. Defaults to false.

Combine targetWidth and targetHeight to resize the output, useful for social media or thumbnail generation.

// Export with target dimensions for social media
const blob = await engine.block.export(p, {
mimeType: 'image/webp',
webpQuality: 0.9,
targetWidth: 1200,
targetHeight: 630
});

Set webpQuality to 1.0 for lossless compression when pixel-perfect output is required.

Built-in Export Action#

Run the exportDesign action to execute the default export flow programmatically.

// Run built-in export with WebP format
await cesdk.actions.run('exportDesign', { mimeType: 'image/webp' });

This executes the registered export action, which handles the complete export process including format selection and file download.

Download Export#

Use cesdk.utils.downloadFile() to trigger the browser’s download dialog for the exported blob.

// Download using CE.SDK utils
await cesdk.utils.downloadFile(blob, 'image/webp');

Pass the blob and MIME type to prompt the user to save the file locally.

API Reference#

API Description
engine.block.export() Exports a block to an image blob with format and quality options
cesdk.actions.run() Runs a built-in action like exportDesign
cesdk.utils.downloadFile() Triggers browser download dialog for a blob

Next Steps#

Export Overview - Learn about all supported export formats and their options.

Export to PDF - Generate print-ready PDF documents from your designs.

Size Limits - Understand export size constraints and optimization strategies.

Partial Export - Export specific blocks or regions instead of the full design.