Generate Email Banner

Generate a personalized email banner image with text, logo, and brand colors.

Who this is for

Marketing teams and email platforms use this recipe to generate a personalized banner image for an email campaign. Define a canvas with your brand colors, add a logo and headline text — ready for embedding in an HTML email.

Request
curl -X POST https://api.iterationlayer.com/image-generation/v1/render \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dimensions": { "width": 600, "height": 200 },
    "layers": [
      {
        "index": 0,
        "type": "solid-color",
        "hex_color": "#1a1a2e"
      },
      {
        "index": 1,
        "type": "image",
        "buffer": "<base64-encoded-logo>",
        "position": { "x": 20.0, "y": 50.0 }
      },
      {
        "index": 2,
        "type": "text",
        "text": "Summer Sale — 30% Off",
        "font_name": "Montserrat",
        "font_size_in_px": 36,
        "text_color": "#FFFFFF",
        "position": { "x": 150.0, "y": 40.0 },
        "dimensions": { "width": 420, "height": 50 }
      },
      {
        "index": 3,
        "type": "text",
        "text": "Shop now at example.com",
        "font_name": "Inter",
        "font_size_in_px": 18,
        "text_color": "#E94560",
        "position": { "x": 150.0, "y": 110.0 },
        "dimensions": { "width": 420, "height": 40 }
      }
    ],
    "output_format": "png"
  }'
Response
{
  "success": true,
  "data": {
    "buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
    "mime_type": "image/png"
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });

const result = await client.generateImage({
  dimensions: { width_in_px: 600, height_in_px: 200 },
  layers: [
    {
      index: 0,
      type: "solid-color",
      hex_color: "#1a1a2e",
    },
    {
      index: 1,
      type: "image",
      buffer: "<base64-encoded-logo>",
      position: { x_in_px: 20, y_in_px: 50 },
    },
    {
      index: 2,
      type: "text",
      text: "Summer Sale — 30% Off",
      font_name: "Montserrat",
      font_size_in_px: 36,
      text_color: "#FFFFFF",
      position: { x_in_px: 150, y_in_px: 40 },
      dimensions: { width_in_px: 420, height_in_px: 50 },
    },
    {
      index: 3,
      type: "text",
      text: "Shop now at example.com",
      font_name: "Inter",
      font_size_in_px: 18,
      text_color: "#E94560",
      position: { x_in_px: 150, y_in_px: 110 },
      dimensions: { width_in_px: 420, height_in_px: 40 },
    },
  ],
  output_format: "png",
});

const imageBuffer = Buffer.from(result.data.buffer, "base64");
Response
{
  "success": true,
  "data": {
    "buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
    "mime_type": "image/png"
  }
}
Request
import base64

from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.generate_image(
    dimensions={"width_in_px": 600, "height_in_px": 200},
    layers=[
        {
            "index": 0,
            "type": "solid-color",
            "hex_color": "#1a1a2e",
        },
        {
            "index": 1,
            "type": "image",
            "buffer": "<base64-encoded-logo>",
            "position": {"x_in_px": 20, "y_in_px": 50},
        },
        {
            "index": 2,
            "type": "text",
            "text": "Summer Sale — 30% Off",
            "font_name": "Montserrat",
            "font_size_in_px": 36,
            "text_color": "#FFFFFF",
            "position": {"x_in_px": 150, "y_in_px": 40},
            "dimensions": {"width_in_px": 420, "height_in_px": 50},
        },
        {
            "index": 3,
            "type": "text",
            "text": "Shop now at example.com",
            "font_name": "Inter",
            "font_size_in_px": 18,
            "text_color": "#E94560",
            "position": {"x_in_px": 150, "y_in_px": 110},
            "dimensions": {"width_in_px": 420, "height_in_px": 40},
        },
    ],
    output_format="png",
)

with open("result.png", "wb") as f:
    f.write(base64.b64decode(result["data"]["buffer"]))
Response
{
  "success": true,
  "data": {
    "buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
    "mime_type": "image/png"
  }
}
Request
package main

import il "github.com/iterationlayer/sdk-go"

client := il.NewClient("YOUR_API_KEY")

result, err := client.GenerateImage(il.GenerateImageRequest{
    Dimensions:   il.Dimensions{WidthInPx: 600, HeightInPx: 200},
    OutputFormat: "png",
    Layers: []il.Layer{
        il.NewSolidColorBackgroundLayer(0, "#1a1a2e"),
        il.NewStaticImageLayer(1, il.FileInput{Buffer: "<base64-encoded-logo>"},
            il.Position{XInPx: 20, YInPx: 50},
            il.Dimensions{}),
        il.NewTextLayer(2, "Summer Sale — 30% Off", "Montserrat", 36, "#FFFFFF",
            il.Position{XInPx: 150, YInPx: 40},
            il.Dimensions{WidthInPx: 420, HeightInPx: 50}),
        il.NewTextLayer(3, "Shop now at example.com", "Inter", 18, "#E94560",
            il.Position{XInPx: 150, YInPx: 110},
            il.Dimensions{WidthInPx: 420, HeightInPx: 40}),
    },
})
Response
{
  "success": true,
  "data": {
    "buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
    "mime_type": "image/png"
  }
}

Related Recipes

Start building in minutes

Free trial credits included. No credit card required.