Watermark an Image

Apply a text watermark to a photo using layer-based image composition for brand protection and copyright.

Who this is for

Photography studios and content platforms use this recipe to protect an image. Use the Image Generation API to composite a base photo with a semi-transparent text watermark overlay — ready for publishing with brand protection built in.

Request
curl -X POST https://api.iterationlayer.com/image-generation/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dimensions": { "width": 1200, "height": 800 },
    "layers": [
      {
        "index": 0,
        "type": "image",
        "buffer": "<base64-encoded-photo>"
      },
      {
        "index": 1,
        "type": "text",
        "text": "© 2026 Your Brand",
        "font_name": "Inter",
        "font_size_in_px": 48,
        "text_color": "#FFFFFF",
        "text_align": "center",
        "vertical_align": "center",
        "position": { "x": 0.0, "y": 0.0 },
        "dimensions": { "width": 1200, "height": 800 },
        "opacity": 30,
        "rotation_in_degrees": -30.0
      }
    ],
    "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: 1200, height_in_px: 800 },
  layers: [
    {
      index: 0,
      type: "image",
      buffer: "<base64-encoded-photo>",
    },
    {
      index: 1,
      type: "text",
      text: "\u00a9 2026 Your Brand",
      font_name: "Inter",
      font_size_in_px: 48,
      text_color: "#FFFFFF",
      text_align: "center",
      vertical_align: "center",
      position: { x_in_px: 0, y_in_px: 0 },
      dimensions: { width_in_px: 1200, height_in_px: 800 },
      opacity: 30,
      rotation_in_degrees: -30.0,
    },
  ],
  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": 1200, "height_in_px": 800},
    layers=[
        {
            "index": 0,
            "type": "image",
            "buffer": "<base64-encoded-photo>",
        },
        {
            "index": 1,
            "type": "text",
            "text": "\u00a9 2026 Your Brand",
            "font_name": "Inter",
            "font_size_in_px": 48,
            "text_color": "#FFFFFF",
            "text_align": "center",
            "vertical_align": "center",
            "position": {"x_in_px": 0, "y_in_px": 0},
            "dimensions": {"width_in_px": 1200, "height_in_px": 800},
            "opacity": 30,
            "rotation_in_degrees": -30.0,
        },
    ],
    output_format="png",
)

with open("watermarked.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: 1200, HeightInPx: 800},
    OutputFormat: "png",
    Layers: []il.Layer{
        il.NewImageOverlayLayer(0, il.FileInput{Buffer: "<base64-encoded-photo>"}),
        il.NewTextLayer(1, "\u00a9 2026 Your Brand", "Inter", 48, "#FFFFFF",
            il.Position{XInPx: 0, YInPx: 0},
            il.Dimensions{WidthInPx: 1200, HeightInPx: 800}),
    },
})
Response
{
  "success": true,
  "data": {
    "buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
    "mime_type": "image/png"
  }
}

Related Recipes

Start building in minutes

Free trial credits included. No credit card required.