# Social image recipes

Source: extracted from `scripts/image_pipeline/` in the aether-plus PLG Cloud repo and adapted for TiDB branded social images.

## What this recipe adds

The pipeline contributes the missing LinkedIn/social image layer:
- Scene recipe for AI-generated backgrounds.
- Headline and badge constraints for branded composites.
- Layout logic for logo, gradients, text, badge, and event metadata.
- Multi-platform dimensions and no-image conventions.
- Language handling for non-English campaigns.

The reference implementation lives in `scripts/image_pipeline/`. For the operator workflow, see `scripts/image_pipeline/README.md`.

## Default LinkedIn composition

Canvas:
- LinkedIn feed: `1200 x 627`.
- Use a dark scene with a clean left text zone and a right-side visual object.

Scene prompt pattern:

```text
A stylized 3D cartoon illustration of [campaign-specific object or metaphor],
small illustration positioned in the right third of the frame.
Left 55% is clean pure black negative space.
Brand colors: translucent red, teal, occasional orange accents.
Dark background, dramatic rim lighting, modern tech startup marketing illustration style.
Sophisticated minimal composition.
No text no words no letters anywhere in the image.
```

Choose the illustrated object from the campaign story:
- Agent memory: memory card, recall graph, persistent state object.
- Launch: rocket, release capsule, deployment switch.
- Benchmark: stopwatch, speed gauge, measuring rig.
- Migration: bridge, moving blocks, consolidation path.
- Webinar or workshop: live console, classroom console, calendar object.
- Scaling or resilience: elastic grid, expanding database core, load wave.

## Headline system

Generate 2-3 headline lines.

Rules:
- Each line should be short enough for a large social-card headline. The original system targets 18 characters and coerces up to 22 characters.
- Use exactly one accent-color line when possible.
- Allowed line colors: `WHITE`, `RED`, `TEAL`, `ORANGE`.
- Keep the message concrete: a result, constraint, or technical promise.
- Do not bake URLs, hashtags, or CTA copy into the image.

Examples:

```json
[
  ["750 Clusters", "WHITE"],
  ["Down to 16", "RED"],
  ["No Downtime", "WHITE"]
]
```

```json
[
  ["Agent State", "WHITE"],
  ["That Scales", "TEAL"]
]
```

## Badge system

Badge:
- Keep it compact. Original prompt asks for 12 characters; implementation coerces up to 20.
- Use a label that names the content type or audience job: `Benchmark`, `Live Demo`, `Tutorial`, `Case Study`, `Workshop`, `Open Source`, `Get Started`.
- Badge color should be `RED` for launches, product, code, benchmarks, or strong announcements.
- Badge color should be `TEAL_DARK` for nurture, activation, education, and tutorial campaigns.

## Layout recipe

The compositor applies these steps:

1. Fit the raw AI scene to the target canvas, anchoring the crop to the right so the illustrated object survives.
2. Darken the scene slightly for text contrast.
3. Add a left-to-right black gradient over roughly 42% of the canvas.
4. Add a subtle top gradient.
5. Add the TiDB logo in the top-left.
6. Add the rounded badge in the top-right.
7. Stack 2-3 large headline lines in the left zone.
8. Add a bottom-left accent line using the badge color.
9. If event metadata exists, render date/time and location below the headline block.
10. Add subtle grain, then export a high-quality PNG.

Do not put small paragraph subtitles in the image. The reference pipeline disabled subtitle rendering because it was not readable at social feed sizes.

## Platform dimensions

| Platform | Default image |
|---|---|
| LinkedIn | 1200 x 627 |
| Twitter/X | 1280 x 720 |
| Twitter/X square | 1080 x 1080 |
| YouTube / Discord | 1280 x 720 |
| Blog / generic OG / Facebook | 1200 x 630 |
| Email header | 600 x 200 |
| HN / Reddit / GitHub / Google Ads | No generated social image by default |

LinkedIn ad creatives can use the same visual system as organic LinkedIn when the asset is a visual sponsored-content unit. Google Ads are treated as externally managed and skipped by this pipeline.

## Language handling

For non-English campaigns, keep the scene prompt in English for the image model, but generate the headline, badge, and subtitle in the campaign language.

The reference implementation has heuristic detection for:
- Brazilian Portuguese
- Spanish
- Japanese
- Korean
- Chinese

When detection triggers, the prompt explicitly tells the model that all visible output text must be in that language and that English examples are structural templates only.

## Manual generation checklist

When generating a LinkedIn card without the Python pipeline:
- Start from the scene prompt pattern above.
- Reserve the left 55% of the image for clean black negative space.
- Put the object or metaphor in the right third.
- Keep all model-generated background imagery text-free.
- Add the TiDB logo top-left after generation, not through the image model.
- Use 2-3 large headline lines, one accent line, and one compact badge.
- Export at `1200 x 627`.
- Write alt text that describes the visual and the campaign concept.
