Systems Library / AI Capabilities / How to Generate Ad Creatives with AI Image Models
AI Capabilities image generation

How to Generate Ad Creatives with AI Image Models

Create scroll-stopping ad images using AI models like GPT Image and Ideogram.

Jay Banlasan

Jay Banlasan

The AI Systems Guy

AI ad creative image generation for business produces scroll-stopping visuals in minutes instead of days. I use this for every ad account I manage. The workflow is: write the concept, route it to the right model, generate one test image, get approval, then batch the variations.

Different models excel at different things. GPT Image handles mockups and infographics. Ideogram nails text-heavy designs. Flux produces photorealistic scenes. Knowing which to use is half the battle.

What You Need Before Starting

Step 1: Choose the Right Model

MODEL_ROUTING = {
    "mockup": "gpt-image-1",      # iMessage, LinkedIn, Reddit mockups
    "infographic": "gpt-image-1",  # Data, stats, numbered lists
    "text_heavy": "ideogram",      # Bold headlines, text overlays
    "photorealistic": "flux-pro",  # Lifestyle scenes, environments
    "vector": "recraft-v4",        # Icons, illustrations, clean graphics
}

def select_model(concept_type):
    return MODEL_ROUTING.get(concept_type, "gpt-image-1")

Step 2: Generate with GPT Image

from openai import OpenAI
import os

client = OpenAI()

def generate_gpt_image(prompt, size="1024x1024"):
    response = client.images.generate(
        model="gpt-image-1",
        prompt=prompt,
        size=size,
        quality="high",
        n=1
    )
    return response.data[0].url

# Example: iMessage mockup ad
prompt = """Create a realistic iMessage conversation screenshot on an iPhone.
The conversation shows:
Person 1: "How much did you pay for your marketing?"
Person 2: "We don't pay for marketing anymore. We built an AI system."
Person 1: "Wait what? How?"
Person 2: "It runs our ads, writes our emails, and generates reports. Cost us less than one hire."
Clean white iMessage interface. Realistic message bubbles. No watermarks."""

image_url = generate_gpt_image(prompt)

Step 3: Generate with Ideogram for Text

import requests

def generate_ideogram(prompt, aspect_ratio="1:1"):
    response = requests.post(
        "https://api.ideogram.ai/generate",
        headers={"Api-Key": os.getenv("IDEOGRAM_API_KEY")},
        json={
            "image_request": {
                "prompt": prompt,
                "aspect_ratio": aspect_ratio,
                "model": "V_2",
                "magic_prompt_option": "AUTO"
            }
        }
    )
    return response.json()["data"][0]["url"]

# Example: Bold headline ad
prompt = """Bold black text on white background:
"Your competitors are using AI.
You're still hiring."
Clean, minimal design. San-serif font. Professional business style."""

Step 4: Batch Generate Variations

After the first image gets approved, create variations:

def generate_batch(base_prompt, variations, model_fn):
    results = []
    for var in variations:
        full_prompt = f"{base_prompt}\n\nVariation: {var['description']}"
        try:
            url = model_fn(full_prompt)
            results.append({"variation": var["name"], "url": url, "status": "success"})
        except Exception as e:
            results.append({"variation": var["name"], "error": str(e), "status": "failed"})
    return results

variations = [
    {"name": "v1_blue", "description": "Blue gradient background instead of white"},
    {"name": "v2_dark", "description": "Dark mode version with white text on black"},
    {"name": "v3_bold", "description": "Larger headline text, more minimal layout"},
]

Step 5: Export at Required Sizes

from PIL import Image
import requests
from io import BytesIO

def resize_for_ads(image_url, output_prefix):
    response = requests.get(image_url)
    img = Image.open(BytesIO(response.content))

    sizes = {
        "feed": (1080, 1080),
        "story": (1080, 1350),
        "landscape": (1200, 628),
    }

    paths = {}
    for name, size in sizes.items():
        resized = img.resize(size, Image.LANCZOS)
        path = f"output/{output_prefix}_{name}.png"
        resized.save(path)
        paths[name] = path

    return paths

What to Build Next

Build a prompt library. Store every prompt that produced a winning ad alongside its performance metrics. When you need a new creative, start from a proven prompt pattern instead of writing from scratch.

Related Reading

Want this system built for your business?

Get a free assessment. We will map every system your business needs and show you the ROI.

Get Your Free Assessment

Related Systems