Configure size limits to balance quality and performance in headless Node.js workflows.
CE.SDK processes images and videos in server environments using CPU and GPU resources, which means size limits depend on your server’s hardware capabilities and available memory. Understanding and configuring these limits helps you build automation workflows that deliver high-quality results while maintaining efficient resource usage in batch processing, serverless functions, and containerized deployments.
This guide covers how to configure the maxImageSize setting for headless workflows, understand server-side constraints, and implement robust error handling for size-related scenarios in production deployments.
Understanding Size Limits#
CE.SDK manages size limits at two stages: input (when loading images) and output (when exporting). The maxImageSize setting controls input resolution, automatically downscaling images that exceed the configured limit (default: 4096×4096px). This prevents memory issues in serverless functions and containerized environments. Export resolution has no artificial limits—the theoretical maximum is 16,384×16,384 pixels, constrained by server GPU/CPU capabilities, available RAM, and deployment environment (serverless memory limits, container quotas, VM allocations). Headless environments use software rendering with conservative limits for universal compatibility.
Resolution & Duration Limits#
| Constraint | Recommendation / Limit |
|---|---|
| Input Resolution | Maximum input resolution is 4096×4096 pixels. Images from external sources (e.g., Unsplash) are resized to this size before rendering on the canvas. You can modify this value using the maxImageSize setting. |
| Output Resolution | There is no enforced output resolution limit. Theoretically, the editor supports output sizes up to 16,384×16,384 pixels. However, practical limits depend on the device’s GPU capabilities and available memory. |
All image processing in CE.SDK is handled client-side, so these values depend on the maximum texture size supported by the user’s hardware. The default limit of 4096×4096 is a safe baseline that works universally. Higher resolutions (e.g., 8192×8192) may work on certain devices but could fail on others during export if the GPU texture size is exceeded.
| Constraint | Recommendation / Limit |
|---|---|
| Resolution | Up to 4K UHD is supported for playback and export, depending on the user’s hardware and available GPU resources. For import, CE.SDK does not impose artificial limits, but maximum video size is bounded by the 32-bit address space of WebAssembly (wasm32) and the browser tab’s memory cap (~2 GB). |
| Frame Rate | 30 FPS at 1080p is broadly supported; 60 FPS and high-res exports benefit from hardware acceleration |
| Duration | Stories and reels of up to 2 minutes are fully supported. Longer videos are also supported, but we generally found a maximum duration of 10 minutes to be a good balance for a smooth editing experience and a pleasant export duration of around one minute on modern hardware. |
Configuring maxImageSize#
You can read and modify the maxImageSize setting using the Settings API to match your server infrastructure and automation requirements.
Reading the Current Setting#
To check what maxImageSize value is currently configured:
// Read the current maxImageSize settingconst currentMaxImageSize = engine.editor.getSetting('maxImageSize');// eslint-disable-next-line no-consoleconsole.log(`Current maxImageSize: ${currentMaxImageSize}px`);// Default is 4096 pixels - safe baseline for universal compatibilityThis returns the maximum size in pixels as an integer value (e.g., 4096 for the default 4096×4096 limit). You might log this value during server startup to verify configuration, use it to make runtime decisions about asset loading strategies, or include it in diagnostics when troubleshooting export failures.
Setting a New Value#
Configure maxImageSize to minimize memory usage in serverless and containerized environments:
// Configure maxImageSize for low memory environments// This must be set BEFORE loading images to ensure they're downscaledengine.editor.setSetting('maxImageSize', 2048);// eslint-disable-next-line no-consoleconsole.log( `Updated maxImageSize: ${engine.editor.getSetting('maxImageSize')}px`);The setting takes effect immediately for newly loaded images. Images already loaded in the scene retain their current resolution until reloaded.
Observing Settings Changes#
Subscribe to setting changes to log configuration updates or trigger automation workflows:
// Subscribe to settings changes to react to configuration updatesconst unsubscribe = engine.editor.onSettingsChanged(() => { const newMaxImageSize = engine.editor.getSetting('maxImageSize'); // eslint-disable-next-line no-console console.log(`maxImageSize changed to: ${newMaxImageSize}px`);});This callback fires whenever any setting changes through the Settings API. You can use it to log configuration changes for auditing, update internal metrics tracking, or synchronize settings across distributed processing nodes.
GPU Capability Detection#
In server environments, rendering capabilities depend on the available hardware rather than browser-based WebGL. CE.SDK automatically detects and uses the best available rendering backend for your server configuration.
When CE.SDK runs in headless Node.js environments, it uses software rendering with conservative limits that provide universal compatibility. On servers with GPU access (such as cloud instances with GPU support), CE.SDK can leverage hardware acceleration for faster processing and larger export dimensions.
You can use this information to:
- Set conservative
maxImageSizedefaults based on your server’s hardware specifications - Configure different limits for serverless functions vs. dedicated GPU servers
- Implement automatic fallback to lower resolutions when memory is constrained
- Calculate safe export dimensions based on available RAM and processing time limits
For production deployments, test your specific server configuration to determine optimal size limits that balance quality with resource constraints.
Troubleshooting#
Common issues and solutions when working with size limits in server environments:
| Issue | Cause | Solution |
|---|---|---|
| Images appear blurry in exports | maxImageSize too low | Increase maxImageSize if server memory supports it (test with monitoring) |
| Out of memory errors during processing | maxImageSize too high | Decrease maxImageSize to reduce memory footprint, or increase server memory allocation |
| Export fails silently | Output exceeds rendering backend limits | Reduce export dimensions or test server’s actual rendering capabilities |
| Serverless function timeout | Export takes too long for large images | Lower maxImageSize to 2048, reduce export dimensions, or use dedicated server |
| Inconsistent results across nodes | Different server configurations | Set conservative maxImageSize (4096) or normalize infrastructure |
| Batch processing runs out of memory | Concurrent exports exceed available RAM | Process sequentially, reduce maxImageSize, or increase server memory |
| Container OOM killed | Export exceeds container memory limit | Increase container memory quota or reduce maxImageSize |
API Reference#
Core methods for managing size limits and export operations:
| Method | Description |
|---|---|
engine.editor.getSetting() | Retrieves the current value of a setting |
engine.editor.setSetting() | Updates a setting value |
engine.editor.onSettingsChanged() | Subscribes to setting change events |
engine.block.export() | Exports a block as an image or video |
engine.block.getWidth() | Gets the width of a block in pixels |
engine.block.getHeight() | Gets the height of a block in pixels |
Next Steps#
Explore related guides to build complete server automation workflows:
- Settings Guide - Complete Settings API reference and configuration options
- File Format Support - Supported image and video formats with capabilities
- Export Overview - Fundamentals of exporting images and videos from CE.SDK
- Export to PDF - PDF export guide with multi-page support and print optimization