Generate Product Promo Card

Generate a product promotional card with a product photo, sale badge, and pricing text.

Who this is for

E-commerce teams use this recipe to generate promotional cards for ads, social media, or email campaigns. Define a clean canvas with a product photo, overlay a bold sale badge with pricing, and add product name and call-to-action text — ready for Instagram ads, Facebook campaigns, or newsletter banners.

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": 800, "height": 1000 },
    "layers": [
      {
        "index": 0,
        "type": "solid-color",
        "hex_color": "#FFFFFF"
      },
      {
        "index": 1,
        "type": "image",
        "buffer": "<base64-encoded-product-photo>",
        "position": { "x": 100.0, "y": 40.0 }
      },
      {
        "index": 2,
        "type": "solid-color",
        "hex_color": "#DC2626",
        "position": { "x": 560.0, "y": 40.0 },
        "dimensions": { "width": 200, "height": 70 }
      },
      {
        "index": 3,
        "type": "text",
        "text": "$29.99",
        "font_name": "Montserrat",
        "font_size_in_px": 36,
        "text_color": "#FFFFFF",
        "font_weight": "Bold",
        "text_align": "center",
        "position": { "x": 560.0, "y": 50.0 },
        "dimensions": { "width": 200, "height": 50 }
      },
      {
        "index": 4,
        "type": "text",
        "text": "Ultra-Light Running Shoes",
        "font_name": "Inter",
        "font_size_in_px": 32,
        "text_color": "#1a1a1a",
        "font_weight": "Bold",
        "text_align": "center",
        "position": { "x": 50.0, "y": 780.0 },
        "dimensions": { "width": 700, "height": 50 }
      },
      {
        "index": 5,
        "type": "text",
        "text": "Shop Now →",
        "font_name": "Inter",
        "font_size_in_px": 22,
        "text_color": "#DC2626",
        "font_weight": "Bold",
        "text_align": "center",
        "position": { "x": 250.0, "y": 880.0 },
        "dimensions": { "width": 300, "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: 800, height_in_px: 1000 },
  output_format: "png",
  layers: [
    {
      index: 0,
      type: "solid-color",
      hex_color: "#FFFFFF",
    },
    {
      index: 1,
      type: "image",
      buffer: "<base64-encoded-product-photo>",
      position: { x_in_px: 100, y_in_px: 40 },
    },
    {
      index: 2,
      type: "solid-color",
      hex_color: "#DC2626",
      position: { x_in_px: 560, y_in_px: 40 },
      dimensions: { width_in_px: 200, height_in_px: 70 },
    },
    {
      index: 3,
      type: "text",
      text: "$29.99",
      font_name: "Montserrat",
      font_size_in_px: 36,
      text_color: "#FFFFFF",
      font_weight: "Bold",
      text_align: "center",
      position: { x_in_px: 560, y_in_px: 50 },
      dimensions: { width_in_px: 200, height_in_px: 50 },
    },
    {
      index: 4,
      type: "text",
      text: "Ultra-Light Running Shoes",
      font_name: "Inter",
      font_size_in_px: 32,
      text_color: "#1a1a1a",
      font_weight: "Bold",
      text_align: "center",
      position: { x_in_px: 50, y_in_px: 780 },
      dimensions: { width_in_px: 700, height_in_px: 50 },
    },
    {
      index: 5,
      type: "text",
      text: "Shop Now →",
      font_name: "Inter",
      font_size_in_px: 22,
      text_color: "#DC2626",
      font_weight: "Bold",
      text_align: "center",
      position: { x_in_px: 250, y_in_px: 880 },
      dimensions: { width_in_px: 300, height_in_px: 40 },
    },
  ],
});

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": 800, "height_in_px": 1000},
    output_format="png",
    layers=[
        {
            "index": 0,
            "type": "solid-color",
            "hex_color": "#FFFFFF",
        },
        {
            "index": 1,
            "type": "image",
            "buffer": "<base64-encoded-product-photo>",
            "position": {"x_in_px": 100, "y_in_px": 40},
        },
        {
            "index": 2,
            "type": "solid-color",
            "hex_color": "#DC2626",
            "position": {"x_in_px": 560, "y_in_px": 40},
            "dimensions": {"width_in_px": 200, "height_in_px": 70},
        },
        {
            "index": 3,
            "type": "text",
            "text": "$29.99",
            "font_name": "Montserrat",
            "font_size_in_px": 36,
            "text_color": "#FFFFFF",
            "font_weight": "Bold",
            "text_align": "center",
            "position": {"x_in_px": 560, "y_in_px": 50},
            "dimensions": {"width_in_px": 200, "height_in_px": 50},
        },
        {
            "index": 4,
            "type": "text",
            "text": "Ultra-Light Running Shoes",
            "font_name": "Inter",
            "font_size_in_px": 32,
            "text_color": "#1a1a1a",
            "font_weight": "Bold",
            "text_align": "center",
            "position": {"x_in_px": 50, "y_in_px": 780},
            "dimensions": {"width_in_px": 700, "height_in_px": 50},
        },
        {
            "index": 5,
            "type": "text",
            "text": "Shop Now →",
            "font_name": "Inter",
            "font_size_in_px": 22,
            "text_color": "#DC2626",
            "font_weight": "Bold",
            "text_align": "center",
            "position": {"x_in_px": 250, "y_in_px": 880},
            "dimensions": {"width_in_px": 300, "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 (
    "encoding/base64"
    "os"

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

func main() {
    client := il.NewClient("YOUR_API_KEY")

    result, err := client.GenerateImage(il.GenerateImageRequest{
        Dimensions:   il.Dimensions{WidthInPx: 800, HeightInPx: 1000},
        OutputFormat: "png",
        Layers: []il.Layer{
            il.NewSolidColorBackgroundLayer(0, "#FFFFFF"),
            il.NewStaticImageLayer(1, il.FileInput{Buffer: "<base64-encoded-product-photo>"},
                il.Position{XInPx: 100, YInPx: 40},
                il.Dimensions{}),
            il.NewRectangleLayer(2, "#DC2626",
                il.Position{XInPx: 560, YInPx: 40},
                il.Dimensions{WidthInPx: 200, HeightInPx: 70}),
            il.NewTextLayer(3, "$29.99", "Montserrat", 36, "#FFFFFF",
                il.Position{XInPx: 560, YInPx: 50},
                il.Dimensions{WidthInPx: 200, HeightInPx: 50}),
            il.NewTextLayer(4, "Ultra-Light Running Shoes", "Inter", 32, "#1a1a1a",
                il.Position{XInPx: 50, YInPx: 780},
                il.Dimensions{WidthInPx: 700, HeightInPx: 50}),
            il.NewTextLayer(5, "Shop Now →", "Inter", 22, "#DC2626",
                il.Position{XInPx: 250, YInPx: 880},
                il.Dimensions{WidthInPx: 300, HeightInPx: 40}),
        },
    })
    if err != nil {
        panic(err)
    }

    decoded, _ := base64.StdEncoding.DecodeString(result.Data.Buffer)
    os.WriteFile("result.png", decoded, 0644)
}
Response
{
  "success": true,
  "data": {
    "buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
    "mime_type": "image/png"
  }
}

Related Recipes

Start building in minutes

Free trial credits included. No credit card required.