AI-Generated Advertising Banners
A typical situation: a marketer spends half a day manually cutting 15 banners for Yandex.Direct, Google Ads, and VK. Then the designer redoes them because the text didn't fit or the background obscures the product. And so it goes for every new ad cycle. AI-based automation solves this pain: one source yields a hundred ready-made variations in minutes. Our solution focuses on AI banner generation and ad creative automation, supporting multiple banner format generation for Yandex.Direct banners, Google Ads banners, and VK ads banners. We utilize neural networks for advertising, automatic banner cropping, and MLOps for advertising to ensure efficiency. Creative costs drop 5–10 times, and campaign launch speed increases dramatically. We implement a system that generates banners from scratch: background from a prompt (using Flux image generation), text overlay using a grid, adaptation to specific sizes. Everything runs on Python + Flux/DALL-E + custom compositors. With 5+ years of experience and 50+ ad automation projects, we ensure reliable implementation, including banner generation for large e-commerce platforms.
Typical Problems in Banner Creation
Manual cropping for 8+ formats—designers have to manually adapt layouts to every size. We automate it: one prompt yields all sizes simultaneously. Text-background mismatch—the algorithm checks contrast and applies a semi-transparent overlay so the text is readable on any background. Lack of A/B tests—generating dozens of A/B testing banners takes seconds, not days.
How AI Generates Banners for Different Formats
Basic scenario: upload a product image + a text brief (headline, subhead, CTA, brand color). The system generates a background via prompt in a consistent style, then programmatically overlays elements according to proportions. Composer code:
from PIL import Image, ImageDraw, ImageFont
import io
class BannerGenerator:
STANDARD_SIZES = {
# Яндекс.Директ
"yandex_240x400": (240, 400),
"yandex_300x250": (300, 250),
"yandex_728x90": (728, 90),
# Google Ads
"google_300x250": (300, 250),
"google_160x600": (160, 600),
"google_970x250": (970, 250),
# ВКонтакте
"vk_1080x607": (1080, 607),
# Telegram Ads
"telegram_800x418": (800, 418),
}
def __init__(self):
self.image_gen = FluxImageGenerator() # или DALL-E / SDXL
async def generate_banner_set(
self,
product_image: bytes,
headline: str,
subtext: str,
cta: str,
brand_color: str,
sizes: list[str] = None
) -> dict[str, bytes]:
target_sizes = sizes or list(self.STANDARD_SIZES.keys())
results = {}
# Генерируем базовое background изображение
bg_prompt = f"abstract background, {brand_color} color scheme, modern minimalist, no text, banner design"
background = await self.image_gen.generate(bg_prompt, width=1920, height=1080)
for size_name in target_sizes:
w, h = self.STANDARD_SIZES[size_name]
banner = self.compose_banner(
background=background,
product_image=product_image,
headline=headline,
subtext=subtext,
cta=cta,
brand_color=brand_color,
size=(w, h)
)
results[size_name] = banner
return results
def compose_banner(
self,
background: bytes,
product_image: bytes,
headline: str,
subtext: str,
cta: str,
brand_color: str,
size: tuple
) -> bytes:
w, h = size
bg = Image.open(io.BytesIO(background)).resize(size, Image.LANCZOS)
canvas = bg.copy()
draw = ImageDraw.Draw(canvas)
# Накладываем полупрозрачный оверлей
overlay = Image.new("RGBA", size, (0, 0, 0, 100))
canvas = Image.alpha_composite(canvas.convert("RGBA"), overlay).convert("RGB")
draw = ImageDraw.Draw(canvas)
# Товар (если горизонтальный баннер — слева, иначе по центру)
if w > h: # горизонтальный
product = Image.open(io.BytesIO(product_image)).convert("RGBA")
product.thumbnail((h - 20, h - 20))
canvas.paste(product, (10, (h - product.height) // 2), product.split()[3])
text_x = h + 10
else:
product = Image.open(io.BytesIO(product_image)).convert("RGBA")
product.thumbnail((w - 20, h // 2))
canvas.paste(product, ((w - product.width) // 2, 10), product.split()[3])
text_x = 10
# Текст
try:
font_headline = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", max(12, h // 8))
font_sub = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", max(10, h // 12))
except:
font_headline = ImageFont.load_default()
font_sub = font_headline
draw.text((text_x, h // 2), headline, fill="white", font=font_headline)
draw.text((text_x, h // 2 + h // 8 + 5), subtext, fill="#DDDDDD", font=font_sub)
# CTA кнопка
cta_y = h - h // 5
draw.rounded_rectangle([text_x, cta_y, text_x + w // 3, cta_y + h // 8], radius=5, fill=brand_color)
draw.text((text_x + 10, cta_y + 5), cta, fill="white", font=font_sub)
buf = io.BytesIO()
canvas.save(buf, format="PNG")
return buf.getvalue()
Why AI Generation Is Faster Than Manual Work
Compare: a designer spends 4–6 hours preparing 10 variations for three formats. An AI system does the same in 2 minutes. Time savings: 120x. Moreover, the number of formats grows to 8+, and A/B tests to 10+ variants. CTR increases by an average of 12% due to automatic headline selection. According to implementation results, creative savings reach 80%, which in monetary terms means a cost of $5 per 100 banners instead of $500. For large campaigns, this translates to thousands of dollars saved monthly.
How to Select the Best Banner Texts
One image is combined with dozens of text variants. Headlines (up to 30 chars), subheads (up to 60), and CTAs (up to 20) are generated via GPT-4o with few-shot examples from your niche. A/B generation code:
async def generate_ab_variants(
base_brief: dict,
num_variants: int = 5
) -> list[dict]:
"""Генерируем варианты для A/B тестирования"""
client = AsyncOpenAI()
response = await client.chat.completions.create(
model="gpt-4o",
messages=[{
"role": "system",
"content": f"Создай {num_variants} вариантов текста для рекламного баннера. Для каждого: headline (до 30 символов), subtext (до 60 символов), cta (до 20 символов). Верни JSON массив."
}, {
"role": "user",
"content": f"Продукт: {base_brief['product']}\nЦА: {base_brief['audience']}\nОффер: {base_brief['offer']}"
}],
response_format={"type": "json_object"}
)
variants_text = json.loads(response.choices[0].message.content)["variants"]
results = []
for variant in variants_text:
banners = await generator.generate_banner_set(
product_image=base_brief["product_image"],
**variant,
brand_color=base_brief["brand_color"]
)
results.append({"text": variant, "banners": banners})
return results
Integration with Ad Accounts
class AdPlatformUploader:
async def upload_to_yandex_direct(self, banners: dict, campaign_id: str): ...
async def upload_to_vk_ads(self, banners: dict, account_id: str): ...
async def upload_to_google_ads(self, banners: dict, customer_id: str): ...
Upload occurs via official APIs: Yandex.Direct API and Google Ads API.
Comparison: Manual Cropping vs AI Generation
| Parameter | Manual Work | AI Generation |
|---|---|---|
| Time for 10 variations | 4–6 hours | 2 minutes |
| Number of formats | up to 3 | up to 8+ |
| A/B tests | 1–2 variants | 10+ variants |
| Cost per 100 banners | $500 | $5 |
What's Included in the Ready Solution
| Component | Description |
|---|---|
| Background Generator | Flux / DALL-E 3 / SDXL with prompt optimization for brand style |
| Composer | Python module on Pillow: overlay text, logo, CTA, products |
| A/B Variants | GPT-4o text generation + automatic cutting of all combinations |
| Upload to Accounts | Direct API integrations: Yandex.Direct, Google Ads, VK Ads |
| Monitoring | Collect click/impression statistics by variant, auto-select the best |
Case: online store with 5000+ products
For an e-commerce project, we deployed banner generation across all product categories. The system automatically inserted current prices, discounts, and seasonal prompts. Creative preparation time was reduced 15x, and CTR increased by 12% thanks to A/B testing of headlines. This resulted in significant savings on designers' time and costs.Implementation Process
- Analytics — we study your advertising structure, platform formats, brand book.
- Design — select a generation model (Flux / DALL-E / SDXL), configure prompts.
- Implementation — write integration with Pillow, account APIs, A/B module.
- Testing — run on 100+ real placements, fix artifacts.
- Deployment — deploy on your infrastructure or cloud, train the team.
Timelines and Cost
- MVP generator with one template and 3 sizes — from 1 to 2 weeks.
- Full system with A/B tests, text variations, and integration — from 3 to 5 weeks.
- Customization for platform specifics (additional formats, brand book) — from 2 weeks.
Cost is calculated individually per task. Assessment takes 1 business day — send a brief. We guarantee correct composition and integration with any platforms. Order a consultation on implementing AI banner generation. Contact us for a system demonstration.







