In this example, we explain how to configure the Creative Engine to use assets hosted on your own servers. While we serve all assets from our own CDN by default, it is highly recommended to serve the assets from your own servers in a production environment.
1. Register IMG.LY’s default assets#
Register each default asset source by pointing Engine.asset.addLocalSourceFromJSON at its content.json manifest. Right after initialization:
val engine = Engine("ly.img.engine.example")engine.start()
val baseUri = Uri.parse("https://cdn.img.ly/packages/imgly/cesdk-android/1.78.0/assets")val sourceIds = listOf( "ly.img.sticker", "ly.img.vector.shape", "ly.img.filter", "ly.img.color.palette", "ly.img.effect", "ly.img.blur", "ly.img.typeface", "ly.img.crop.presets", "ly.img.page.presets", "ly.img.text", "ly.img.text.styles", "ly.img.text.curves", "ly.img.text.components",)coroutineScope { sourceIds.forEach { id -> launch { engine.asset.addLocalSourceFromJSON( contentUri = "$baseUri/$id/content.json".toUri(), ) } }}The current default sources are:
ly.img.sticker- Various stickers.ly.img.vector.shape- Shapes and arrows.ly.img.filter- Filter effects (LUT and duotone).ly.img.color.palette- Default color palette.ly.img.effect- Default effects.ly.img.blur- Default blurs.ly.img.typeface- Default typefaces.ly.img.crop.presets- Default crop presets.ly.img.page.presets- Default page resize presets.ly.img.text- Plain text presets (title, headline, body).ly.img.text.styles- Decorative text style presets.ly.img.text.curves- Curved text / text-on-path presets.ly.img.text.components- Text combinations (text designs) library.
2. Copy Assets#
Download the IMG.LY default assets from our CDN. Copy the extracted folders to your own CDN server or to the android assets folder if you want to use them offline. It can be on the root or any subfolder.
3. Configure the IMGLYEngine to use your self-hosted assets#
Next, we need to configure the SDK to use the copied assets instead of the ones served via IMG.LY CDN. Point baseUri at the location of your copy and re-run the registration loop from step 1.
In case you have copied to your own cdn path:
val baseUri = Uri.parse("https://cdn.your.custom.domain/assets")In case you have copied to android assets folder:
val baseUri = Uri.parse("file:///android_asset/assets")4. Configure Engine-Level Assets#
The engine uses additional assets for font fallback (Unicode character coverage) and emoji rendering. By default, these are loaded from https://cdn.img.ly/assets/v4. When you configure the basePath setting, font fallback files and the emoji font are automatically loaded from that location:
engine.editor.setSettingString("basePath", "https://cdn.your.custom.domain/cesdk-assets")This setting affects:
- Font fallback files — Used when text contains characters not covered by the selected font. Located at
{basePath}/fonts/font-{index}.ttf. - Emoji font — The default emoji font (NotoColorEmoji.ttf). Located at
{basePath}/emoji/NotoColorEmoji.ttf.
To self-host these assets:
- The
fonts/andemoji/directories are already included in theimgly-assets.zipdownload - After extracting, set
basePathto point to your extraction location
For android assets folder:
engine.editor.setSettingString("basePath", "file:///android_asset/cesdk-assets")