A unique background for every page, from one URL
Put a URL in an <img> tag or in your og:image and get a low poly background back. Use the post slug as the seed and every article gets its own image, the same one every time, with no design work and no files to store.
<img src="https://trianglebg.com/api/bg?seed=my-first-post&palette=ocean" alt="" />Examples
/api/bg?seed=hello-world&palette=midnight&title=Hello%2C%20world/api/bg?seed=acme&colors=0f172a,0ea5e9,f0f9ff/api/bg?seed=42&palette=sunset&direction=y&cell=50Dynamic OG images in Next.js
Every post gets a 1200×630 social image with its title on it. Because the output depends only on the URL, the image is cached by the CDN after the first request.
// app/blog/[slug]/page.tsx
export async function generateMetadata({ params }) {
const { slug } = await params;
const post = await getPost(slug);
const og = new URL("https://trianglebg.com/api/bg");
og.searchParams.set("seed", slug);
og.searchParams.set("title", post.title);
og.searchParams.set("palette", "midnight");
return { openGraph: { images: [{ url: og.toString(), width: 1200, height: 630 }] } };
}Parameters
GET https://trianglebg.com/api/bg. All parameters are optional.
| Name | Values | Default | Notes |
|---|---|---|---|
| seed | any text, up to 200 chars | trianglebg | Same seed and settings always give the same image. Use a post slug or title. |
| w, h | 16–4096 | 1200, 630 | Output size in pixels. |
| palette | ocean, sunset, dark, forest, midnight, pastel | ocean | Built-in palette. |
| colors | 3 hex colors, comma separated | – | Your own gradient, dark to light. Overrides palette. |
| cell | 10–1000 | 90 | Triangle size. Smaller means more triangles. |
| variance | 0–1 | 0.45 | How irregular the triangles are. |
| intensity | 0–1 | 0.35 | Color difference between neighbouring triangles. |
| direction | x, y, diagonal, diagonalReverse | diagonal | Gradient direction. |
| format | png, svg | png | SVG needs an API key. |
| title | text, up to 120 chars | – | Centered headline over the background. PNG only. |
| key | your API key | – | Unlocks SVG and sizes above the free limit. |
Invalid parameters return a 400 response with a JSON error message.
Free
- PNG up to 1280×720 (or 720×1280)
- Covers OG images (1200×630) and blog headers
- Titles, custom colors, all settings
- No signup
With an API key
- PNG up to 4096×4096
- SVG output
- For wallpapers, print and retina hero images
Prefer to design by hand? Open the editor.