# OG Image Generator — Social Share Images for Blogs (`abidchaudhry/og-image-generator`) Actor

Generate polished 1200x630 Open Graph / Twitter card images from a title and brand parameters. 4 designed templates, batch mode for entire blogs.

- **URL**: https://apify.com/abidchaudhry/og-image-generator.md
- **Developed by:** [Abid Chaudhry](https://apify.com/abidchaudhry) (community)
- **Categories:** Automation, Developer tools, Marketing
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## OG Image Generator — Social Share Images for Blogs

Generate polished **1200×630 Open Graph images** (the preview cards shown when your link is shared on X, LinkedIn, Slack, Discord, iMessage…) from a title and a few brand parameters. No design tool, no @vercel/og code to maintain, no serverless function to deploy — call an actor, get a PNG.

Links **with** a designed share image get dramatically more clicks than links with a gray placeholder. Most blogs still ship the placeholder because making one image per post is annoying. This actor makes it a build step.

### Templates

| Template | Look |
|----------|------|
| `gradient` | Bold white title on a rich two-color gradient with a soft highlight |
| `split` | Editorial white panel with a colored side band + kicker label |
| `dark` | Near-black, serif headline, accent underline — great for dev blogs |
| `photo` | Your image full-bleed with a gradient scrim and overlaid title |

All templates support: author name + avatar (or auto initials circle), site name or logo, subtitle (date / read time), and your brand colors. Long titles auto-scale to fit.

### Example input

```json
{
  "template": "dark",
  "title": "How we cut our cloud bill by 70% in one weekend",
  "author": "Jane Doe",
  "subtitle": "12 min read · June 2026",
  "siteName": "engineering.acme.dev",
  "accent": "#22d3ee"
}
````

### Batch a whole blog

Pass `images[]` and the top-level fields become defaults — generate every post's OG image in one run (up to 500). Include a `slug` per item and it's passed through to the output for easy matching:

```json
{
  "template": "split",
  "siteName": "acme.dev",
  "accent": "#e11d48",
  "images": [
    { "slug": "cloud-bill", "title": "How we cut our cloud bill by 70%", "kicker": "INFRA" },
    { "slug": "hiring", "title": "What 200 failed interviews taught us", "kicker": "CULTURE" }
  ]
}
```

### Output

Each image lands in the key-value store, and a dataset item gives you a stable URL:

```json
{ "index": 0, "slug": "cloud-bill", "template": "split", "url": "https://api.apify.com/v2/key-value-stores/.../records/og-000.png", "width": 1200, "height": 630 }
```

Point your `<meta property="og:image">` at the URL, or copy the file into your static build.

### Automation recipes

- **Static site**: run the actor in CI with your posts' front-matter, download the PNGs into `/public/og/`.
- **CMS webhook**: on publish → call the actor → save the URL back to the post's OG field.
- **Newsletter**: generate a share image per issue automatically.

# Actor input Schema

## `template` (type: `string`):

Visual style.

## `title` (type: `string`):

The headline of the page/article. Required.

## `subtitle` (type: `string`):

Small line next to the author (e.g. date, read time, tagline).

## `author` (type: `string`):

Shown with an avatar (or initials circle) at the bottom.

## `authorImage` (type: `string`):

Optional https:// avatar for the author.

## `siteName` (type: `string`):

Brand text shown top-left when no logo is provided.

## `logoUrl` (type: `string`):

Optional https:// logo image shown top-left instead of the site name.

## `kicker` (type: `string`):

Small uppercase category label above the title.

## `accent` (type: `string`):

Hex accent (split band, dark underline, initials circle).

## `bg` (type: `string`):

Gradient template: start color (hex).

## `bg2` (type: `string`):

Gradient template: end color (hex).

## `imageUrl` (type: `string`):

Full-bleed https:// background image.

## `retina` (type: `boolean`):

Render at 2400x1260. Standard OG consumers only need 1200x630 (default).

## `images` (type: `array`):

Generate many images in one run — one object per image with the same fields as above (plus optional "slug" passed through to the output for matching). Top-level fields act as defaults.

## Actor input object example

```json
{
  "template": "gradient",
  "title": "How we cut our cloud bill by 70% in one weekend",
  "accent": "#4f46e5",
  "bg": "#4f46e5",
  "bg2": "#9333ea",
  "retina": false
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "title": "How we cut our cloud bill by 70% in one weekend"
};

// Run the Actor and wait for it to finish
const run = await client.actor("abidchaudhry/og-image-generator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "title": "How we cut our cloud bill by 70% in one weekend" }

# Run the Actor and wait for it to finish
run = client.actor("abidchaudhry/og-image-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "title": "How we cut our cloud bill by 70% in one weekend"
}' |
apify call abidchaudhry/og-image-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=abidchaudhry/og-image-generator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "OG Image Generator — Social Share Images for Blogs",
        "description": "Generate polished 1200x630 Open Graph / Twitter card images from a title and brand parameters. 4 designed templates, batch mode for entire blogs.",
        "version": "0.1",
        "x-build-id": "PVBCQpRwGTAoXZGfq"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/abidchaudhry~og-image-generator/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-abidchaudhry-og-image-generator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/abidchaudhry~og-image-generator/runs": {
            "post": {
                "operationId": "runs-sync-abidchaudhry-og-image-generator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/abidchaudhry~og-image-generator/run-sync": {
            "post": {
                "operationId": "run-sync-abidchaudhry-og-image-generator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "template": {
                        "title": "Template",
                        "enum": [
                            "gradient",
                            "split",
                            "dark",
                            "photo"
                        ],
                        "type": "string",
                        "description": "Visual style.",
                        "default": "gradient"
                    },
                    "title": {
                        "title": "Title",
                        "type": "string",
                        "description": "The headline of the page/article. Required."
                    },
                    "subtitle": {
                        "title": "Subtitle",
                        "type": "string",
                        "description": "Small line next to the author (e.g. date, read time, tagline)."
                    },
                    "author": {
                        "title": "Author name",
                        "type": "string",
                        "description": "Shown with an avatar (or initials circle) at the bottom."
                    },
                    "authorImage": {
                        "title": "Author image URL",
                        "type": "string",
                        "description": "Optional https:// avatar for the author."
                    },
                    "siteName": {
                        "title": "Site name",
                        "type": "string",
                        "description": "Brand text shown top-left when no logo is provided."
                    },
                    "logoUrl": {
                        "title": "Logo URL",
                        "type": "string",
                        "description": "Optional https:// logo image shown top-left instead of the site name."
                    },
                    "kicker": {
                        "title": "Kicker (split template)",
                        "type": "string",
                        "description": "Small uppercase category label above the title."
                    },
                    "accent": {
                        "title": "Accent color",
                        "type": "string",
                        "description": "Hex accent (split band, dark underline, initials circle).",
                        "default": "#4f46e5"
                    },
                    "bg": {
                        "title": "Gradient start color",
                        "type": "string",
                        "description": "Gradient template: start color (hex).",
                        "default": "#4f46e5"
                    },
                    "bg2": {
                        "title": "Gradient end color",
                        "type": "string",
                        "description": "Gradient template: end color (hex).",
                        "default": "#9333ea"
                    },
                    "imageUrl": {
                        "title": "Background image URL (photo template)",
                        "type": "string",
                        "description": "Full-bleed https:// background image."
                    },
                    "retina": {
                        "title": "Retina (2x) output",
                        "type": "boolean",
                        "description": "Render at 2400x1260. Standard OG consumers only need 1200x630 (default).",
                        "default": false
                    },
                    "images": {
                        "title": "Batch: images array (advanced)",
                        "type": "array",
                        "description": "Generate many images in one run — one object per image with the same fields as above (plus optional \"slug\" passed through to the output for matching). Top-level fields act as defaults."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
