code-to-image
Code to Image API
Generate beautiful code snippet images with syntax highlighting via html2png.dev.
How It Works
- Write HTML with syntax-highlighted code (use Shiki or similar)
- Style with Tailwind CSS or custom CSS
- Send to
/api/convertendpoint - Get a shareable image URL
Endpoint
POST https://html2png.dev/api/convert
Example
More from html2png/skills
html-to-image
Generate crisp, high-quality images with perfect typography and precise geometric layouts using HTML/CSS. Use when creating social cards, diagrams, certificates, UI mockups, code screenshots, or any image requiring sharp text rendering, exact alignment, or vector-like precision. AI excels at designing symmetric, pixel-perfect layouts as HTML rather than generating raster images directly. Supports Tailwind CSS, Google Fonts, icon libraries, and any web-based design resource.
121website-screenshot
Capture screenshots of live websites and web pages via API. Use when users need to screenshot a URL, capture website previews, archive web pages, generate thumbnails of sites, or document web content. Ideal for monitoring, archiving, sharing website previews, or creating visual references of web pages.
42og-image
Generate Open Graph (OG) images and social media preview cards for websites, blog posts, and products. Use when creating social share images, Twitter/X cards, LinkedIn post images, or any visual preview that appears when sharing links on social platforms. Produces properly sized images (1200x630, 1200x675, etc.) with crisp typography and professional layouts.
23