Sub topic 9
Text, Logos, and Why to Add Them Afterwards
This chapter assumes you can write a basic image prompt, you know what a creative brief is, and you are comfortable with resolution, aspect ratio, and file formats. The code examples use Python with the Pillow library. Pillow is an image library that you install with pip install pillow.
Why generators struggle with text
Most AI image tools build a picture by gradually refining noise into shapes that look statistically like their training images. They do not "spell". A letter is just another shape, and the model has no built-in list of valid words. This leads to predictable defects:
- Misspelled or invented words, such as "SPRNG SALLE".
- Letters that look right at thumbnail size but turn into gibberish when you zoom in.
- Repeated, merged, or missing characters.
- Inconsistent fonts within one word.
- Mirrored or warped letters on curved surfaces like bottles and mugs.
Some newer tools render short, simple text much better than older ones. Even so, they still fail often enough that you cannot trust them unchecked. A single wrong letter in a published ad is costly, and you cannot patch it with another prompt without regenerating the whole image.
Logos are harder still. A logo is a precise arrangement of shapes, colors, and proportions. A generator can only produce something that resembles a logo, and an approximation of your brand mark is a brand error. A generator may also produce a logo that resembles a real company's mark, which creates legal risk (see the chapter on licensing and responsible use).
The core rule: generate the picture, add the text afterwards
The reliable workflow separates two jobs:
- The generator makes the image and leaves room for text.
- A design or editing tool places the real text, the real logo, and any legal lines on top.
This gives you several advantages.
| Concern | Text inside the generated image | Text added afterwards |
|---|---|---|
| Spelling | Can be wrong, hard to fix | Exact, typed by you |
| Brand font | Approximate at best | Your actual font file |
| Logo accuracy | Approximation | The official asset |
| Editing copy later | Requires regeneration | Edit a text layer |
| Localization | Regenerate per language | Swap the string |
| A/B testing headlines | New image each time | Same image, new text |
The last two rows matter for marketing. If the headline is a separate layer, you can produce ten language versions or five test headlines from one approved image.
Prompting for space, not for words
Your prompt should reserve an empty area where the text will go. Describe the composition, and exclude text explicitly.
The creative brief from earlier chapters already carries this idea in its must_include and must_avoid fields:
{
"goal": "Drive sign-ups for the spring trail-running promotion",
"channel": "Instagram feed, 4:5 portrait",
"audience": "Recreational runners aged 25-40",
"mood": "energetic, optimistic",
"must_include": ["trail setting", "morning light", "space for a headline at the top"],
"must_avoid": ["readable text", "brand logos", "identifiable real people"],
"brand_colors": ["#0B3D91", "#F2A900"]
}The same idea appears in the prompt builder. Its composition field reserves the empty area, and avoid excludes text and logos:
BRIEF = {
"subject": "a stainless steel water bottle on a flat rock beside a mountain lake",
"style": "clean product photography, soft natural light, shallow depth of field",
"palette": "cool blues and warm gray",
"composition": "bottle on the right third of the frame, empty space on the left for a headline",
"avoid": "text, logos, people",
}
def build_prompt(brief):
parts = [
brief["subject"],
brief["style"],
f"Color palette: {brief['palette']}",
f"Composition: {brief['composition']}",
f"Do not include: {brief['avoid']}",
]
return ". ".join(parts) + "."
print(build_prompt(BRIEF))Some points on writing the "space" instruction well:
- Name the location: "empty space at the top", "left third of the frame is clear".
- Ask for a calm area. Say "smooth sky", "out-of-focus background", or "plain wall" so the text region is not busy.
- Do not ask for a "blank sign" or "empty banner" in the scene. Generators often fill these with fake lettering.
- Check where the subject actually landed. The model may ignore your layout request, so verify before designing around it.
Exclusions are not guaranteed
Telling a tool "no text" lowers the chance of lettering, but it does not remove it. Many tools have no true negative prompt. In those, wording like "do not include text" can even prime the model with the idea of text. If stray lettering appears on packaging, signs, or clothing, you have three options:
- Regenerate with a scene that has fewer surfaces for text, such as a plain bottle instead of a labeled one.
- Use inpainting to repaint only the offending region (covered in the chapter on reference images and editing).
- Cover the area in post-production, for example with a clean crop or a placed element.
Adding text with a script
For one-off work, a design tool is fine. For a campaign with many sizes or languages, a script keeps results consistent. The example below places a headline on a generated image using a real font file, a semi-transparent panel for legibility, and brand colors from the brief.
from pathlib import Path
from PIL import Image, ImageDraw, ImageFont
BRAND_BLUE = "#0B3D91"
BRAND_GOLD = "#F2A900"
def add_headline(source_path, out_path, text, font_path, margin=60):
with Image.open(source_path) as base:
img = base.convert("RGBA")
width, height = img.size
font_size = max(24, width // 14)
font = ImageFont.truetype(font_path, font_size)
# Draw on a separate transparent layer, then composite.
overlay = Image.new("RGBA", img.size, (0, 0, 0, 0))
draw = ImageDraw.Draw(overlay)
left, top, right, bottom = draw.textbbox((0, 0), text, font=font)
text_w, text_h = right - left, bottom - top
pad = 24
x, y = margin, margin
panel = (x - pad, y - pad, x + text_w + pad, y + text_h + pad)
draw.rectangle(panel, fill=(11, 61, 145, 200)) # BRAND_BLUE at ~78% opacity
draw.text((x - left, y - top), text, font=font, fill=BRAND_GOLD)
result = Image.alpha_composite(img, overlay).convert("RGB")
Path(out_path).parent.mkdir(parents=True, exist_ok=True)
result.save(out_path, quality=92)
add_headline(
"bottle_hero.png",
"out/bottle_headline.jpg",
"Spring Trail Series",
"fonts/BrandSans-Bold.ttf",
)Details that commonly cause trouble:
ImageFont.truetypeneeds a path to a real.ttfor.otffile. Use your brand font, not a system default.textbboxreturns offsets, so subtractleftandtopwhen drawing. Otherwise the text sits a few pixels away from where the panel expects it.- Pillow does not wrap lines on its own. For long headlines, split the string yourself and measure each line, or shorten the copy.
- Pillow does not handle complex scripts such as Arabic or Devanagari well by default. For those languages, use a design tool or a library with proper text shaping.
- Always check contrast between text and background. A panel, a gradient, or a darkened area behind the text keeps it readable on busy photos.
Placing logos
Use the official logo file from your brand kit, never a generated approximation. Prefer a vector source (SVG) exported to a high-resolution PNG with a transparent background.
from PIL import Image
def place_logo(base_path, logo_path, out_path, width_ratio=0.18, margin=48):
with Image.open(base_path) as base_img:
base = base_img.convert("RGBA")
with Image.open(logo_path) as logo_img:
logo = logo_img.convert("RGBA")
target_w = int(base.width * width_ratio)
target_h = int(logo.height * target_w / logo.width)
logo = logo.resize((target_w, target_h), Image.Resampling.LANCZOS)
position = (base.width - target_w - margin, base.height - target_h - margin)
base.alpha_composite(logo, dest=position)
base.convert("RGB").save(out_path, quality=92)
place_logo("out/bottle_headline.jpg", "brand/logo_white.png", "out/bottle_final.jpg")Follow the brand guidelines for clear space around the logo, minimum size, and which version (full color, white, or dark) to use on which background. Scale the logo relative to the image width, as above, so it stays proportional across sizes.
Where text and logos fit in the pipeline
Add text after you have chosen the final image, and add it at the final size for each channel. If you add a headline first and then crop for different channels, the text may be cut off.
Exporting to each size first lets you position the text per format. A headline that fits at the top of a 4:5 feed image may need to move on a 9:16 story, where platform interface elements cover the top and bottom of the screen. Keep text inside the safe zone for each placement.
Edge cases and judgment calls
- Text that is part of the scene. A street sign or a book spine in the background does not need to be readable. Blur or shallow depth of field makes unreadable text look natural instead of broken.
- Lettering as the subject. For a poster where the typography is the art, such as hand-lettered styles, a generator may be appropriate. Treat every character as unverified, and proofread letter by letter. Plan to regenerate several times.
- Product packaging. If your product has a real label, generated packaging will not match it. Use a photo of the real product with the generator (see reference images and editing), or composite the real product shot into a generated background.
- Tools with strong text rendering. Even if your tool handles short words well, keep the layered workflow for headlines, legal lines, prices, and anything translated. Those need exactness and later edits.
- Required legal text. Disclaimers, prices, dates, and disclosure labels must be typed by a person and reviewed. Never rely on generated characters for them.
- Accessibility. Text baked into pixels cannot be read by screen readers. Where the channel allows it, put the message in the caption or alt text as well.
Quick checklist
- The brief states where text will go and bans readable text in the generation.
- The prompt reserves a calm, empty region.
- The chosen image is free of stray lettering and fake logos.
- Headlines use the brand font, typed by a person and proofread.
- The logo comes from the official asset with correct size and clear space.
- Text stays inside the safe zone of each channel size.
- Contrast is checked on the final export.
Exercise
Your generator produced a great image of a runner on a trail, but the shirt shows the garbled lettering "NIKKE RUNN". The composition is exactly what you want. Name two ways to fix the problem without changing the composition, and explain why you would not just ask the generator to "fix the text" by regenerating from the same prompt.
Show answer
Two options: (1) use inpainting to repaint only the shirt area as a plain shirt, or with a blank chest area, leaving the rest of the image untouched; (2) cover the area in post-production, for example by compositing a plain shirt region or cropping if the layout allows. Regenerating from the same prompt produces a new image, so the composition you liked would change, and the generator might produce new lettering errors. The garbled word also resembles a real brand name, so it is both a quality defect and a possible legal risk. After the fix, add any real branding yourself using the official logo file.
Exercise
A campaign needs the same hero image in English, Spanish, and German, in square and story sizes, with the headline in the brand font. Describe the order of steps and say why adding the text last saves work.
Show answer
Generate one image with space reserved for text and no readable lettering, review and approve it, then export the square and story sizes. For each size and language, add the typed headline in the brand font, place the official logo, and check contrast and the safe zone. Adding text last means one approved image serves all six outputs, so a copy change or a new translation only needs a new text layer. If the text were baked into the generation, each language and size would need a new generation and a new round of spelling review.