grad_bg
Blazing-fast image generation

Flashot

Transform your code snippets into stunning, shareable images with elegant design, flawless performance and professional highlighting.

800+ downloads
MIT Licensed
TypeScript ready
index.js
import { writeFile } from "node:fs/promises";
import { codeToImg } from "flashot";

const buffer = await codeToImg('console.log("hello, world!");', {
  theme: "monokai",
  format: "png",
  style: { borderRadius: 16, padding: 24 }
});
await writeFile("inline.png", buffer);
Generate Image
~ 135ms
Quick Setup

Get started in seconds

Install via your favorite package manager and start generating beautiful code images instantly

NPM
Popular
$ npm install flashot
JSR
Modern
$ npx jsr add @thuongtruong/flashot
YARN
$ yarn add flashot
BUN
Fast
$ bun install flashot
🚀 Quick CLI Demo
Try it now
$ npm install -g flashot$ flashot code "console.log('Hello world')" -o hello.png
Features & Capabilities

Built for Excellence

Everything you need to create professional, shareable code visuals with stunning themes and pixel-perfect quality

100+ Languages

JavaScript, TypeScript, Python, Java, C++ and more with perfect syntax highlighting

Multiple Themes

GitHub Dark, Dracula, Monokai, Solarized and many beautiful themes

Multi-format Support

Export as PNG, JPEG, WebP, AVIF with custom quality settings

Blazing Fast

Optimized rendering with caching, generates images in ~135ms

Highly Customizable

Control fonts, padding, border radius, line numbers and colors

Dual Module Support

Works with ESM and CommonJS with TypeScript definitions

CLI & API Ready

Use as Node.js package or command-line tool for any workflow

High Quality Output

Generate crisp, professional images perfect for documentation

Line Numbers

Display and customize line numbers with custom colors

Syntax Highlighting

Advanced highlighting with custom backgrounds and effects

Multiple Input Types

Support for inline code, file paths, URLs, and buffer data

Open Source

MIT licensed with comprehensive documentation and community

Built with Modern Technologies

Leveraging the best tools for performance, reliability and developer experience

Bun logo
Bun
Fast all-in-one JavaScript runtime
TypeScript logo
TypeScript
Type-safe development with strict mode
Vite logo
Vite
Lightning-fast build tool
Tsdown logo
Tsdown
Powerful TypeScript package tool
Vitest logo
Vitest
Blazing fast unit testing framework
Shiki logo
Shiki
Beautiful syntax highlighting
Takumi logo
Takumi
Render container highlighting
Biome logo
Biome
Fast formatter and linter
ESLint logo
ESLint
Advanced linting with TypeScript
Commander logo
Commander
Command-line interface builder
Tinybench logo
Tinybench
Tiny benchmarking library
Lefthook logo
Lefthook
Automated Git hooks