Search
Loading...
Skip to content

Options

Export your designs to multiple formats including PNG, JPEG, WebP, PDF, and MP4. CE.SDK handles all export processing entirely on the client side, giving you fine-grained control over format-specific options like compression, quality, and target dimensions.

Export overview showing different export format options

10 mins
estimated time
Download
StackBlitz
GitHub

Whether you’re building a design tool, photo editor, or content automation workflow, understanding export options helps you deliver the right output for each use case. This guide covers supported formats, their options, and how to export programmatically or via the UI.

This guide covers how to export designs in different formats, configure format-specific options, check device limits, and download exports to the user’s device.

Supported Export Formats#

CE.SDK supports exporting scenes, pages, groups, or individual blocks in these formats:

FormatMIME TypeTransparencyBest For
PNGimage/pngYesWeb graphics, UI elements, logos
JPEGimage/jpegNoPhotographs, web images
WebPimage/webpYes (lossless)Web delivery, smaller files
PDFapplication/pdfPartialPrint, documents
MP4video/mp4NoVideo content
Binaryapplication/octet-streamYesRaw data processing

Each format serves different purposes. PNG preserves transparency and works well for graphics with sharp edges or text. JPEG compresses photographs efficiently but drops transparency. WebP provides excellent compression with optional lossless mode. PDF preserves vector information for print workflows. MP4 exports animated content as video.

Export Images#

Export to PNG#

PNG export uses lossless compression with a configurable compression level. Higher compression produces smaller files but takes longer to encode. Quality is not affected.

const pngBlob = await engine.block.export(page, {
mimeType: 'image/png',
pngCompressionLevel: 5 // 0-9, higher = smaller file, slower
});

The pngCompressionLevel ranges from 0 (no compression, fastest) to 9 (maximum compression, slowest). The default is 5, which balances file size and encoding speed.

Export to JPEG#

JPEG export uses lossy compression controlled by the quality setting. Lower quality produces smaller files but introduces visible artifacts.

const jpegBlob = await engine.block.export(page, {
mimeType: 'image/jpeg',
jpegQuality: 0.9 // 0-1, higher = better quality, larger file
});

The jpegQuality ranges from 0 to 1. Values above 0.9 provide excellent quality for most use cases. The default is 0.9.

Export to WebP#

WebP provides better compression than PNG or JPEG for web delivery. A quality of 1.0 enables lossless mode.

const webpBlob = await engine.block.export(page, {
mimeType: 'image/webp',
webpQuality: 1.0 // 1.0 = lossless, smaller files than PNG
});

The webpQuality ranges from 0 to 1. At 1.0, WebP uses lossless compression that typically produces smaller files than equivalent PNG exports.

Image Export Options#

OptionTypeDefaultDescription
mimeTypestring-Output format: 'image/png', 'image/jpeg', or 'image/webp'
pngCompressionLevelnumber5PNG compression level (0-9). Higher = smaller file, slower encoding
jpegQualitynumber0.9JPEG quality (0-1). Higher = better quality, larger file
webpQualitynumber0.8WebP quality (0-1). Set to 1.0 for lossless compression
targetWidthnumber-Target output width in pixels
targetHeightnumber-Target output height in pixels

Export PDF#

PDF export preserves vector information and supports print workflows. The high compatibility option rasterizes content for broader viewer support.

const pdfBlob = await engine.block.export(page, {
mimeType: 'application/pdf',
exportPdfWithHighCompatibility: true // Rasterize for broader viewer support
});

When exportPdfWithHighCompatibility is true (the default), images and effects are rasterized according to the scene’s DPI setting. Set it to false for faster exports, though gradients with transparency may not render correctly in Safari or macOS Preview.

The underlayer options are useful for print workflows where you need a solid base layer (often white ink) beneath the design elements. The underlayerSpotColorName should match a spot color defined in your print workflow.

PDF Export Options#

OptionTypeDefaultDescription
mimeTypestring-Must be 'application/pdf'
exportPdfWithHighCompatibilitybooleantrueRasterize images and effects (like gradients) according to the scene’s DPI setting for broader viewer support
exportPdfWithUnderlayerbooleanfalseAdd an underlayer behind existing elements matching the shape of page content
underlayerSpotColorNamestring''Spot color name for the underlayer fill (used with print workflows)
underlayerOffsetnumber0Size adjustment for the underlayer shape in design units
targetWidthnumber-Target output width in pixels
targetHeightnumber-Target output height in pixels

Export with Color Mask#

Color mask export removes pixels matching a specific RGB color and generates two output files: the masked image with transparency applied, and an alpha mask showing which pixels were removed.

// Export with color mask - RGB values are in 0.0-1.0 range
// Pure magenta (1.0, 0.0, 1.0) is commonly used for registration marks
const [maskedImage, alphaMask] = await engine.block.exportWithColorMask(
page,
1.0, // maskColorR - red component
0.0, // maskColorG - green component
1.0, // maskColorB - blue component (RGB: pure magenta)
{ mimeType: 'image/png' }
);

The exportWithColorMask() method accepts the block to export, three RGB color components (0.0-1.0 range), and optional export options. RGB values use floating-point notation where 1.0 equals 255 in standard color notation.

Common mask colors for print workflows:

  • Pure red: (1.0, 0.0, 0.0) — Registration marks
  • Pure magenta: (1.0, 0.0, 1.0) — Distinctive marker color
  • Pure cyan: (0.0, 1.0, 1.0) — Alternative marker color

The method returns a Promise resolving to an array of two Blobs: the masked image (with matched pixels made transparent) and the alpha mask (black pixels for removed areas, white for retained areas).

Color Mask Export Options#

The exportWithColorMask() method accepts the same options as image export:

OptionTypeDefaultDescription
mimeTypestring'image/png'Output format: 'image/png', 'image/jpeg', or 'image/webp'
pngCompressionLevelnumber5PNG compression level (0-9)
jpegQualitynumber0.9JPEG quality (0-1)
webpQualitynumber0.8WebP quality (0-1)
targetWidthnumber-Target output width in pixels
targetHeightnumber-Target output height in pixels

Export Video#

Video export uses the H.264 codec and outputs MP4 or QuickTime files. Unlike image exports, video exports accept a progress callback to track encoding status.

const page = engine.scene.getCurrentPage();
const videoBlob = await engine.block.exportVideo(page, {
mimeType: 'video/mp4',
onProgress: (rendered, encoded, total) => {
console.log(`Progress: ${Math.round((encoded / total) * 100)}%`);
}
});

Video Export Options#

Configure video encoding with these options:

OptionTypeDefaultDescription
mimeType'video/mp4' | 'video/quicktime''video/mp4'Output video format
h264Profilenumber77 (Main)H.264 profile: 66=Baseline, 77=Main, 100=High
h264Levelnumber52Encoding level (multiply desired level by 10, e.g., 52 = level 5.2)
videoBitratenumber0 (auto)Video bitrate in bits/second. Maximum determined by profile and level
audioBitratenumber0 (auto)Audio bitrate in bits/second. Default auto-selects 128kbps for stereo AAC
frameratenumber30Target framerate in Hz
targetWidthnumber-Output width in pixels
targetHeightnumber-Output height in pixels
timeOffsetnumber0Start time offset in seconds
durationnumberscene durationVideo duration in seconds
allowTextOverhangbooleanfalseInclude text bounding boxes that account for glyph overhangs
abortSignalAbortSignal-Signal to cancel export

The h264Profile determines encoder quality and compatibility:

  • Baseline (66): Broadest device compatibility, lowest quality
  • Main (77): Good balance of quality and compatibility (default)
  • High (100): Best quality, may not play on older devices

Export Audio#

Export audio tracks from pages or audio blocks. Supported formats are WAV (uncompressed) and MP4 (AAC encoded).

const page = engine.scene.getCurrentPage();
const audioBlob = await engine.block.exportAudio(page, {
mimeType: 'audio/mp4', // or 'audio/wav'
onProgress: (rendered, encoded, total) => {
console.log(`Progress: ${Math.round((encoded / total) * 100)}%`);
}
});

Audio Export Options#

Configure audio export with these options:

OptionTypeDefaultDescription
mimeType'audio/wav' | 'audio/mp4''audio/wav'Output audio format
sampleRatenumber48000Sample rate in Hz
numberOfChannelsnumber2Number of audio channels (1=mono, 2=stereo)
timeOffsetnumber0Start time offset in seconds
durationnumberblock durationAudio duration in seconds
skipEncodingbooleanfalseReturn raw audio data without encoding
abortSignalAbortSignal-Signal to cancel export

Use audio/wav for lossless quality when file size is not a concern. Use audio/mp4 (AAC) for compressed output suitable for web delivery.

Target Size Control#

You can export at specific dimensions regardless of the block’s actual size. The targetWidth and targetHeight options render the block large enough to fill the target size while maintaining aspect ratio.

const blob = await engine.block.export(page, {
mimeType: 'image/png',
targetWidth: 1920,
targetHeight: 1080
});

If the target aspect ratio differs from the block’s aspect ratio, the output fills the target dimensions completely. The output may extend beyond the target size on one axis to preserve correct proportions.

Device Export Limits#

Before exporting large designs, check the device’s export capabilities. Memory constraints or GPU limitations may prevent exports that exceed certain dimensions.

const maxExportSize = engine.editor.getMaxExportSize();
const availableMemory = engine.editor.getAvailableMemory();
console.log(`Max dimension: ${maxExportSize}px`);
console.log(`Available memory: ${availableMemory / 1024 / 1024} MB`);

getMaxExportSize() returns the maximum width or height in pixels. Both dimensions must stay below this limit. getAvailableMemory() returns available memory in bytes, helping you assess whether large exports are feasible.

Built-in Export Action#

CE.SDK provides a built-in exportDesign action that handles export with progress dialogs and error handling. Use cesdk.utils.export() to export and cesdk.utils.downloadFile() to download the result.

Export an image:

const { blobs, options } = await cesdk.utils.export({
mimeType: 'image/png'
});
await cesdk.utils.downloadFile(blobs[0], options.mimeType);

Export a PDF:

const { blobs, options } = await cesdk.utils.export({
mimeType: 'application/pdf'
});
await cesdk.utils.downloadFile(blobs[0], options.mimeType);

Export a video:

const { blobs, options } = await cesdk.utils.export({
mimeType: 'video/mp4'
});
await cesdk.utils.downloadFile(blobs[0], options.mimeType);

API Reference#

MethodDescription
engine.block.export()Export a block with format and quality options
engine.block.exportWithColorMask()Export a block with specific RGB color removed, returning masked image and alpha mask
engine.block.exportVideo()Export a page as video with encoding options
engine.block.exportAudio()Export audio from a page or audio block
engine.editor.getMaxExportSize()Get maximum export dimension in pixels
engine.editor.getAvailableMemory()Get available memory in bytes
cesdk.utils.export()Export with progress dialog and error handling
cesdk.utils.downloadFile()Download a blob or string to the user’s device