Generate multiple image variants for a single data point.

Prerequisites#
Before you begin, make sure you have the following:
- Node.js v22+ and npm installed locally – Download Node.js
- A supported browser – Chrome 114+, Edge 114+, Firefox 115+, Safari 15.6+
See Browser Support for the full list.
Get Started#
Start fresh with a standalone Multi Image Generation project. This creates a complete, ready-to-run React application built with Vite. To add the editor to your SvelteKit project, use the Existing Project tab.
Step 1: Clone the Repository#
git clone https://github.com/imgly/starterkit-multi-image-generation-react-web.gitgit clone https://github.com/imgly/starterkit-multi-image-generation-react-web.gitnpx degit imgly/starterkit-multi-image-generation-react-web starterkit-multi-image-generation-react-webnpx degit imgly/starterkit-multi-image-generation-react-web starterkit-multi-image-generation-react-webThe src/ folder contains the application:
src/├── app/ # Demo application├── imgly/│ ├── index.ts # Editor initialization function│ ├── demo-assets.ts # Demo asset URLs│ ├── asset-sources.ts # Asset source setup│ ├── generation.ts # Design generation logic│ ├── headless-engine.ts # Headless engine setup│ ├── types.ts # TypeScript type definitions│ ├── utils.ts # Utility functions│ └── config/│ ├── advanced-design-editor/│ │ ├── plugin.ts # Main configuration plugin│ │ ├── actions.ts # Export/import actions│ │ ├── features.ts # Feature toggles│ │ ├── i18n.ts # Translations│ │ ├── settings.ts # Engine settings│ │ ├── keyboard/ # Keyboard shortcuts│ │ │ ├── keyboard.ts # Shortcut registration│ │ │ └── catalogs/│ │ │ └── us-ansi.ts # Key catalog│ │ └── ui/ # UI customization│ │ ├── index.ts # Combines UI customization exports│ │ ├── canvas.ts # Canvas configuration│ │ ├── components.ts # Custom component registration│ │ ├── dock.ts # Dock layout configuration│ │ ├── inspectorBar.ts # Inspector bar layout│ │ ├── navigationBar.ts # Navigation bar layout│ │ ├── panel.ts # Panel configuration│ │ └── videoTimeline.ts # Timeline configuration│ └── design-editor/ # Same structure as advanced-design-editor/└── index.tsx # Application entry pointStep 2: Install Dependencies#
Install the required packages:
cd starterkit-multi-image-generation-react-web
npm installcd starterkit-multi-image-generation-react-web
npm installcd starterkit-multi-image-generation-react-web
pnpm installcd starterkit-multi-image-generation-react-web
pnpm installcd starterkit-multi-image-generation-react-web
yarncd starterkit-multi-image-generation-react-web
yarnStep 3: Download Assets#
CE.SDK requires engine assets (fonts, icons, UI elements) to function. For production, serve them as static files from your project’s public/ directory.
curl -O https://cdn.img.ly/packages/imgly/cesdk-js/1.87.0-rc.3/imgly-assets.zip
unzip imgly-assets.zip -d public/
rm imgly-assets.zipcurl -O https://cdn.img.ly/packages/imgly/cesdk-js/1.87.0-rc.3/imgly-assets.zip
unzip imgly-assets.zip -d public/
rm imgly-assets.zipWithout further setup, the editor loads these assets from the IMG.LY CDN, which is for development only. To use the downloaded copy, set baseURL: '/assets' in the editor configuration in src/index.tsx. To add your license key, add one of the two license lines below to the same object, without the leading //. Option 1 puts the key in the code. Option 2 reads VITE_CESDK_LICENSE from a .env file, which you create as a copy of .env.example. Without a license key, the editor runs in evaluation mode and adds a watermark to exports.
const config = { // ... baseURL: '/assets', // license: 'YOUR_CESDK_LICENSE_KEY' // Option 1: the key in the code // license: import.meta.env.VITE_CESDK_LICENSE // Option 2: the key from .env // ...};Step 4: Run the Development Server#
npm run devnpm run devpnpm run devpnpm run devyarn devyarn devOpen http://localhost:5173 in your browser.
Get Started#
Integrate the Multi Image Generation into an existing SvelteKit application. The steps expect a SvelteKit project. The project must have src/lib/ and static/ folders.
Step 1: Clone#
cd your-projectcd your-projectClone the starter kit and copy the editor configuration to your project:
git clone https://github.com/imgly/starterkit-multi-image-generation-react-web.git
cp -r starterkit-multi-image-generation-react-web/src/imgly ./src/lib/imgly
rm -rf starterkit-multi-image-generation-react-webgit clone https://github.com/imgly/starterkit-multi-image-generation-react-web.git
cp -r starterkit-multi-image-generation-react-web/src/imgly ./src/lib/imgly
rm -rf starterkit-multi-image-generation-react-webnpx degit imgly/starterkit-multi-image-generation-react-web/src/imgly ./src/lib/imglynpx degit imgly/starterkit-multi-image-generation-react-web/src/imgly ./src/lib/imglyThe imgly/ folder contains the editor configuration:
imgly/├── index.ts # Editor initialization function├── demo-assets.ts # Demo asset URLs├── asset-sources.ts # Asset source setup├── generation.ts # Design generation logic├── headless-engine.ts # Headless engine setup├── types.ts # TypeScript type definitions├── utils.ts # Utility functions└── config/ ├── advanced-design-editor/ │ ├── plugin.ts # Main configuration plugin │ ├── actions.ts # Export/import actions │ ├── features.ts # Feature toggles │ ├── i18n.ts # Translations │ ├── settings.ts # Engine settings │ ├── keyboard/ # Keyboard shortcuts │ │ ├── keyboard.ts # Shortcut registration │ │ └── catalogs/ │ │ └── us-ansi.ts # Key catalog │ └── ui/ # UI customization │ ├── index.ts # Combines UI customization exports │ ├── canvas.ts # Canvas configuration │ ├── components.ts # Custom component registration │ ├── dock.ts # Dock layout configuration │ ├── inspectorBar.ts # Inspector bar layout │ ├── navigationBar.ts # Navigation bar layout │ ├── panel.ts # Panel configuration │ └── videoTimeline.ts # Timeline configuration └── design-editor/ # Same structure as advanced-design-editor/Step 2: Install Dependencies#
Install the required packages for the editor:
Core Editor#
Install the Creative Editor SDK:
npm install @cesdk/cesdk-js@1.87.0-rc.3npm install @cesdk/cesdk-js@1.87.0-rc.3pnpm add @cesdk/cesdk-js@1.87.0-rc.3pnpm add @cesdk/cesdk-js@1.87.0-rc.3yarn add @cesdk/cesdk-js@1.87.0-rc.3yarn add @cesdk/cesdk-js@1.87.0-rc.3Headless Engine#
Install the headless engine for server-side and batch processing:
npm install @cesdk/engine@1.87.0-rc.3npm install @cesdk/engine@1.87.0-rc.3pnpm add @cesdk/engine@1.87.0-rc.3pnpm add @cesdk/engine@1.87.0-rc.3yarn add @cesdk/engine@1.87.0-rc.3yarn add @cesdk/engine@1.87.0-rc.3Step 3: Download Assets#
CE.SDK requires engine assets (fonts, icons, UI elements) to function. For SvelteKit projects, place these in your static/ directory which is served automatically.
curl -O https://cdn.img.ly/packages/imgly/cesdk-js/1.87.0-rc.3/imgly-assets.zip
unzip imgly-assets.zip -d static/
rm imgly-assets.zipcurl -O https://cdn.img.ly/packages/imgly/cesdk-js/1.87.0-rc.3/imgly-assets.zip
unzip imgly-assets.zip -d static/
rm imgly-assets.zipStep 4: Create the Editor Component#
Choose your editing mode and initialize the editor accordingly:
<script lang="ts"> import { onMount, onDestroy } from 'svelte'; import CreativeEditorSDK from '@cesdk/cesdk-js'; import { initMultiImageGenerationDesignEditor } from './imgly';
let container: HTMLDivElement; let cesdk: CreativeEditorSDK | null = null;
onMount(async () => { cesdk = await CreativeEditorSDK.create(container, { baseURL: '/assets' }); await initMultiImageGenerationDesignEditor(cesdk); await cesdk.actions.run('scene.create'); });
onDestroy(() => { if (cesdk) { cesdk.dispose(); } });</script>
<div bind:this={container} style="width: 100vw; height: 100vh;"></div><script lang="ts"> import { onMount, onDestroy } from 'svelte'; import CreativeEditorSDK from '@cesdk/cesdk-js'; import { initMultiImageGenerationAdvancedDesignEditor } from './imgly';
let container: HTMLDivElement; let cesdk: CreativeEditorSDK | null = null;
onMount(async () => { cesdk = await CreativeEditorSDK.create(container, { baseURL: '/assets' }); await initMultiImageGenerationAdvancedDesignEditor(cesdk); await cesdk.actions.run('scene.create'); });
onDestroy(() => { if (cesdk) { cesdk.dispose(); } });</script>
<div bind:this={container} style="width: 100vw; height: 100vh;"></div>Step 5: Use the Component#
CE.SDK requires browser APIs, so turn off server-side rendering for this page. Create src/routes/+page.ts:
export const ssr = false;Use the component in src/routes/+page.svelte. To use another mode, import its component instead:
<script> import MultiImageGenerationDesignEditor from '../lib/MultiImageGenerationDesignEditor.svelte';</script>
<MultiImageGenerationDesignEditor />On another route, put +page.ts next to the page and adjust the import path. If the page already has a +page.ts, add export const ssr = false to it.
Using the Starterkit#
The imgly/ module provides a unified API for editor initialization, headless rendering, and batch generation. Import what you need from the single entry point:
import { // Editor Initialization initMultiImageGenerationDesignEditor, // Adopter mode (light theme, standard editing) initMultiImageGenerationAdvancedDesignEditor, // Creator mode (dark theme, full template design)
// Configuration Plugins (for direct use) DesignEditorConfig, AdvancedEditorConfig,
// Headless Engine initMultiImageGenerationHeadlessEngine, // Initialize engine without UI renderSceneToImage, // Load scene and export as image
// Generation Utilities fillTemplate, // Fill template with data generateAssets, // Batch generate multiple assets applyRestaurantColors, // Apply brand colors to loaded scene
// Helper Utilities hexToRgba, // Convert hex color to RGBA replaceImageByName, // Replace image block by name exportSceneAsImage // Export current scene as image} from '$lib/imgly';In the cloned starter kit, src/app/App.tsx and src/app/EditorModal/EditorModal.tsx import from the same imgly/ folder.
Editor Initialization#
Use initMultiImageGenerationDesignEditor or initMultiImageGenerationAdvancedDesignEditor to configure the editor with all necessary plugins and asset sources. The starter kit does this in its React file src/app/EditorModal/EditorModal.tsx, so adjust the import path to your imgly/ folder. SCENES is the kit’s src/app/scenes.json:
import CreativeEditor from '@cesdk/cesdk-js/react';import { initMultiImageGenerationDesignEditor, initMultiImageGenerationAdvancedDesignEditor} from '../../imgly';import SCENES from '../scenes.json';
// `template`, `sceneString`, `selectedRestaurant` and `editorBaseConfig` are// props of the EditorModal component
// Determine scene to load: saved scene or fresh templateconst sceneToLoad = sceneString ?? SCENES[template.sceneKey];
<CreativeEditor config={editorBaseConfig} init={async (cesdk) => { // Initialize appropriate editor configuration based on mode if (selectedRestaurant) { await initMultiImageGenerationDesignEditor(cesdk); } else { await initMultiImageGenerationAdvancedDesignEditor(cesdk); }
// Load scene await cesdk.load(sceneToLoad); }}/>Generation Functions#
For batch image generation, use the headless engine with generation utilities:
import { initMultiImageGenerationHeadlessEngine, fillTemplate, generateAssets, exportSceneAsImage} from './imgly';import type { Template } from './imgly';import { DEMO_ASSETS_BASE_URL } from './imgly/demo-assets';
// Scene strings by scene key, for example saved with engine.scene.saveToString()const scenes: Record<string, string> = { square: squareSceneString, portrait: portraitSceneString, landscape: landscapeSceneString};
// Initialize headless engine (no UI)const engine = await initMultiImageGenerationHeadlessEngine();
// Fill a single template with restaurant dataawait fillTemplate(engine, scenes, 'square', restaurant);const imageUrl = await exportSceneAsImage(engine);
// Or generate multiple assets at onceconst templates: Template[] = [ { label: 'Square', sceneKey: 'square', previewImagePath: `${DEMO_ASSETS_BASE_URL}/images/placeholder-1.png`, outputFormat: 'image/png', width: 240, height: 240 }, { label: 'Portrait', sceneKey: 'portrait', previewImagePath: `${DEMO_ASSETS_BASE_URL}/images/placeholder-2.png`, outputFormat: 'image/png', width: 200, height: 280 }, { label: 'Landscape', sceneKey: 'landscape', previewImagePath: `${DEMO_ASSETS_BASE_URL}/images/placeholder-3.png`, outputFormat: 'image/png', width: 280, height: 200 }];
await generateAssets(engine, scenes, templates, restaurant, (index, asset) => { // Called for each generated asset console.log(`Generated ${asset.label}:`, asset.src);});
// Clean up when doneengine.dispose();Set Up a Scene#
Replace the scene.create line from Get Started with one of these calls.
In the cloned starter kit, cesdk is available in the init callback in src/app/EditorModal/EditorModal.tsx.
CE.SDK offers multiple ways to load content into the editor. Choose the method that matches your use case:
// Create a blank design canvas - starts with an empty design sceneawait cesdk.actions.run('scene.create');
// Load from a template archive - restores a previously saved projectawait cesdk.load('https://example.com/template.zip');
// Load from an image URL - creates a new scene with the imageawait cesdk.createFromImage('https://example.com/image.jpg');
// Load from a scene file - restores a saved sceneawait cesdk.load('https://example.com/scene.scene');Key Capabilities#
The Multi Image Generation starter kit enables batch creation of on-brand design variations.
Batch Generation
Generate multiple image variations from a single template with different data inputs.
Data-Driven Design
Connect external data sources to dynamically populate design elements.
Template System
Create reusable templates with placeholders for text, images, and other content.
Multi-Format Export
Export designs in multiple formats and sizes for different platforms.
Real-Time Preview
Preview generated designs instantly before exporting.
Asset Libraries
Access built-in collections of templates, graphics, and fonts.
Troubleshooting#
Editor doesn’t load#
- Check the container element exists: Ensure your container element is in the DOM before calling
create() - Verify the baseURL: Assets must be accessible from the CDN or your self-hosted location
- Match the asset version: If the console says the assets are missing or from a different SDK version, check the installed
@cesdk/cesdk-jsversion. Use thecesdk-jsURL from Step 3 with that version number, and downloadimgly-assets.zipagain. Thecesdk-enginearchive that the console names has noui/folder, so the editor does not start with it - Check console errors: Look for CORS or network errors in browser developer tools
Assets don’t appear#
- Check network requests: Open DevTools Network tab and look for failed requests to
cdn.img.ly - Self-host assets for production: See Serve Assets to host assets on your infrastructure
Watermark appears in production#
- Add your license key: Set the
licenseproperty in your configuration - Get a license: Contact us at img.ly/forms/contact-sales/
Next Steps#
- Configuration – Complete list of initialization options
- Serve Assets – Self-host engine assets for production
- Actions – Build custom export and save workflows
- Theming – Customize colors and appearance
- Localization – Add translations and language support