LinkedIn Image Generator API
Self-hosted Next.js API that generates pixel-perfect LinkedIn post PNG images from a JSON payload. Supports lightweight markdown, emoji rendering, platform-native typography, image galleries, and fully customizable themes.
Context
Needed a simple, self-hostable way to generate Open Graph images that look exactly like LinkedIn posts — for blog previews, mockups, and social media visuals. Existing solutions were either closed, cloud-only, or didn't support the level of customisation required.
Approach
- ·Built a single Next.js API route (Node.js runtime) accepting a JSON payload and returning a binary PNG
- ·Used Satori to convert a React component tree into SVG entirely server-side, with no browser or headless Chrome dependency
- ·Converted the SVG to a high-resolution PNG via @resvg/resvg-js, a Rust-based renderer
- ·Bundled Inter, SF Pro Text, Segoe UI, Roboto, and Noto Emoji fonts locally — no external font API calls at render time
- ·Implemented a lightweight markdown parser for bold, italic, links, and hashtags, plus SVG-sprite-based emoji rendering (Twemoji / Noto Color Emoji)
- ·Added a server-side height estimation algorithm to auto-size the card based on text length, emoji density, and line breaks
- ·Supported LinkedIn-style image gallery layouts (1 to 4+ attachments with overflow badge) and customisable color themes
Solution
A zero-dependency, self-hosted image generation API: POST a JSON object describing the post, receive a PNG. The entire render pipeline — markdown parsing, font loading, SVG generation, PNG conversion — runs in a single Node.js process with no external services.
Key outcome
Generates a full LinkedIn post image in under a second. Covers 25 documented feature scenarios (platform styles, device layouts, markdown, emojis, attachments, themes) each validated by a dedicated test image.
Applications
- ·Open Graph image generation for blogs and websites
- ·LinkedIn post mockups for presentations
- ·Dynamic social media visual generation
- ·Programmatic content preview thumbnails
Project details
Technologies
More projects
View all →YAML Configuration Editor
Custom internal web app that allows non-technical stakeholders at papernest to safely configure data pipelines. Cut pipeline build & test time by ~50% and incident investigation from 30–60 min to under 2 min.
Log Data Visualization Platform
Full-stack internal web application for log data visualization and analysis at Bouygues Telecom. Machine log investigation time reduced from several minutes to near-instant access. Designed and built independently from scratch.
SQL Streaming Module – Documentation & Evolutions
Contributions to an internal SQL-on-Flink streaming module at the core of Bouygues Telecom's ETL. Main deliverable: an automated documentation system and CI/CD integration to make the module production-ready.