How to Keep AI-Generated Marketing Assets On-Brand A new guide from the IMG.LY blog walks through building a web app that locks AI-generated marketing assets to brand rules, with complete code published in the brand guardrails example repository on GitHub. The app confines AI image generation to a single placeholder, restricts colors and fonts to fixed approved lists, locks the logo and legal line, and runs a validator against brand rules before any file is exported. The guide argues that brand guidelines PDFs and shared design libraries only catch off-brand colors, fonts, logo placement and text overflow at human review, while a locked template plus validator enforces them deterministically at export. What You Will Build: Brand Guardrails for AI-Generated Assets By the end of this article you’ll have a web app where a sales rep, franchisee, or customer can create a marketing asset from a locked template. AI generates the image, the user writes the headline, and nothing they do is allowed to deviate from the brand’s style. The logo and legal line can’t be touched, colors and fonts come from a fixed list, and the AI output has exactly one place to land. After that, a validator checks the design against the brand rules before any file is actually generated. The complete code is in the brand guardrails example repository on GitHub https://github.com/imgly/blog-brand-guardrails-ai . This guide will be handy for anyone that has sales teams, franchisees, dealers or customers that make their own marketing assets. Afterwards, you can say goodbye to off-brand output from AI tools that miss the mark and create substandard assets that can’t be used. Brand managers and marketing operations teams will love it. Why Brand Guidelines Do Not Stop Off-Brand AI Assets People are bound to try and make marketing assets with AI at some point, whether their company gives them a tool or not. We’re all familiar with scenarios where a franchisee needs a flyer by Friday, types a prompt, and gets something that looks great, so they go ahead and print it. The problem is that generative AI hardly ever matches the design constraints of a brand. Think about nuances when you critique a branding attempt. The blue is close, but it’s not the brand’s blue, the font is whatever the tool picked, and the logo if not deformed or just plain wrong is squeezed into a corner. Headlines bring their own oddities like running to the edge of the page or spawning in random areas of your image. The usual answer is a brand guidelines PDF and some training. Guidelines can describe the rules, but someone has to read them the horror , remember them, and check every asset manually. Asking an AI system to follow the rules helps, but AI has a tendency to fill in the gaps if your instructions are not explicit. A better approach is to use something that acts as a mechanistic system. The rules live in deterministic code and the editor only does what that code allows. AI output only has one area that it is allowed to land, and a design that still breaks a rule can’t be exported. The ideal scenario is allowing a non-designer to make an asset, and only allowing on-brand files to leave the app. Brand Control Approaches Compared: Guidelines, Shared Libraries, Locked Templates With a Validator | Property | Brand guidelines document | Shared design library with approval step | Locked template plus validator | |---|---|---|---| | Stops off-palette colors | No. It lists the palette, and a reviewer spots misses by eye | Partly. Library assets use the palette, but new elements can use any color until review | Yes. The editor offers only palette colors, and the validator refuses any other color | | Stops wrong fonts | No. It relies on the person reading it | Partly. Shared styles help, but any font can still be picked | Yes. The font list shows only approved faces, and the validator refuses others | | Enforces logo size and clear space | No. A reviewer measures by eye | Partly. The logo file is approved; how it’s placed is checked at review | Yes. The logo is locked, and the validator checks its width and clear space | | Keeps text in the safe area | No | At review, by eye | Yes. Measured on every export, to the pixel | | Limits where AI output can land | No | No. A generated image can go anywhere in the design | Yes. Generation writes only into the image placeholder | | Blocks prohibited content | It lists what isn’t allowed | At review, by a person | Checked at export through a moderation service banned words tested in the demo | | Works for non-designers | Poorly. Applying the rules takes design knowledge | Partly. The library helps, and the approver catches the rest | Yes. The rules are applied for them, and each failure says what to fix | | Needs a human approver | Yes, for every asset | Yes, the approval step | No, for the rules the validator checks. Optional for judgment calls step 6 | | Scales to hundreds of users | No. Review time grows with every user | Only as far as the approvers’ time goes | Yes. Checks run in code, in about a second per design in the test run | | What you have to build | A document | A shared library and a review workflow | A template, a brand kit config, a validator and an export gate | The first two approaches need someone to check everything by eye, which means that output only scales with the number of reviewers you have, not the number of users generating assets. Using the locked template moves the rules into the editor and the validator so that human reviewers have less policing to do. Step 1: Define the Brand Kit Palette, Fonts, Logo Rules “Brand kit” in this article just means your own config and files, not a CE.SDK feature name. In the example app, it’s a TypeScript module with the palette, the approved typefaces, the logo rules, and the safe area for a brand Northwind, in our example . The template gets built from it, and the image generation step takes its prompt prefix from it, leaving the validator to check against it. Each color has a token name, which the editor shows as a convenient swatch label. // src/brand-kit.ts / Colors the user may pick from, as hex. Nothing else is allowed. / export const PALETTE = { blue: ' 1E5ADC', navy: ' 102050', mist: ' EEF2FA', white: ' FFFFFF', } as const; / The two approved typefaces. Both ship in CE.SDK's default typeface library, so there are no font files to host. / export const FONTS = { headline: 'Montserrat', body: 'Open Sans', } as const; export const ALLOWED FONTS: readonly string = Object.values FONTS ; export const LOGO RULES = { / Width to height of the logo files, 600 by 200. / aspectRatio: 3, / Smallest width the logo may be exported at, in pixels. / minWidth: 180, / Empty space around the logo, as a fraction of its height. / clearSpace: 0.5, }; / Every block must sit this many pixels inside the page edges. / export const SAFE AREA INSET = 64; It’s important to realize that the config only describes the rules. installBrandKit is what makes the editor follow them. We’re using the pattern from the IMG.LY Enforce brand guidelines https://img.ly/docs/cesdk/js/rules/enforce-brand-guidelines-23a1e3/ guide. In our example, the editor’s color and typeface libraries are replaced with the brand’s. // src/brand-kit.ts engine.asset.addLocalSource 'brand.colors' ; for const token, hex of Object.entries PALETTE { const { r, g, b } = toRGBA hex ; engine.asset.addAssetToSource 'brand.colors', { id: brand.color.${token} , label: { en: token }, payload: { color: { colorSpace: 'sRGB', r, g, b } }, } ; } cesdk.ui.updateAssetLibraryEntry 'ly.img.colors', { sourceIds: 'brand.colors' , } ; // The two approved faces, copied from CE.SDK's own typeface library so // the font files match the SDK version. const { assets } = await engine.asset.findAssets 'ly.img.typeface', { page: 0, perPage: 100, } ; engine.asset.addLocalSource 'brand.fonts' ; for const asset of assets { if asset.label = null && ALLOWED FONTS.includes asset.label { engine.asset.addAssetToSource 'brand.fonts', { id: asset.id, label: { en: asset.label }, payload: asset.payload, meta: asset.meta, } ; } } cesdk.ui.updateAssetLibraryEntry 'ly.img.typefaces', { sourceIds: 'brand.fonts' , } ; cesdk.feature.disable 'ly.img.fill.color.picker', 'ly.img.text.background', 'ly.img.text.styles', ; To use your own brand, all you need to do is change the values in brand-kit.ts . If your typefaces aren’t in CE.SDK’s default library, simply register them from your own font files, just like the CE.SDK custom fonts guide https://img.ly/docs/cesdk/js/text/custom-fonts-9565b3/ explains. Step 2: Lock the Template and Scope What Users Can Change CE.SDK has two roles that matter here. The Creator role https://img.ly/glossary/creator-role/ ignores every lock and is for whoever designs the template. The Adopter role https://img.ly/glossary/adopter-role/ enforces the locks and is for the people filling it in. buildTemplate builds a 1080 by 1350 page in the Creator role and hands it over in the Adopter role see Lock the template https://img.ly/docs/cesdk/js/create-templates/lock-131489/ . The page has four blocks, and what each one allows is a single table: js // src/template.ts const ALLOWED: Record