Convert code snippets into images. Powered by shiki and takumi. Super fast π
TypeScript
165
64 commits
updated Apr 18, 2026
Convert code snippets into images. Powered by shiki and takumi. Super fast π
Example:
[!NOTE] This was a quick experimental project. Contributors needed!
import { writeFile } from "node:fs/promises";
import { codeToImage } from "shiki-image";
const buffer = await codeToImage('console.log("hello, world!");', {
lang: "js",
theme: "github-dark",
format: "webp",
});
await writeFile("image.webp", buffer);
langCode language. See shiki supported languages
themeRendering theme. See shiki supported theems.
styleAdditional container styles. See takumi stylesheets.
formatOutput format can be either png, webp, avif, or jpeg (default is webp).
qualityImage quality between 0 to 100 (jpeg format only)
fontFont used to render the code. Can be either a string (remote URL to fetch) or an ArrayBuffer.
[!NOTE] If no font is specified, it will use the builtin
Geist Monofont from Takumi.
[!TIP] If a URL is passed, response will be cached in memory for the next renders.
widthRendering width. If not specified, it will be auto computed based on the code.
[!NOTE] Default font size is
32and can be customized usingstyle.fontSize.
heightRendering height. If not specified, it will be auto computed based on the code.
[!NOTE] Default lineHeight is
1.3and can be customized usingstyle.lineHeight.
Published under the MIT license.
TypeScript
94.6%
JavaScript
5.4%
Convert code snippets into images. Powered by shiki and takumi. Super fast π
TypeScript
165
64 commits
updated Apr 18, 2026
Convert code snippets into images. Powered by shiki and takumi. Super fast π
Example:
[!NOTE] This was a quick experimental project. Contributors needed!
import { writeFile } from "node:fs/promises";
import { codeToImage } from "shiki-image";
const buffer = await codeToImage('console.log("hello, world!");', {
lang: "js",
theme: "github-dark",
format: "webp",
});
await writeFile("image.webp", buffer);
langCode language. See shiki supported languages
themeRendering theme. See shiki supported theems.
styleAdditional container styles. See takumi stylesheets.
formatOutput format can be either png, webp, avif, or jpeg (default is webp).
qualityImage quality between 0 to 100 (jpeg format only)
fontFont used to render the code. Can be either a string (remote URL to fetch) or an ArrayBuffer.
[!NOTE] If no font is specified, it will use the builtin
Geist Monofont from Takumi.
[!TIP] If a URL is passed, response will be cached in memory for the next renders.
widthRendering width. If not specified, it will be auto computed based on the code.
[!NOTE] Default font size is
32and can be customized usingstyle.fontSize.
heightRendering height. If not specified, it will be auto computed based on the code.
[!NOTE] Default lineHeight is
1.3and can be customized usingstyle.lineHeight.
Published under the MIT license.
TypeScript
94.6%
JavaScript
5.4%