Code Shot
代码0 行
样式
导出
图片在本地渲染,代码不上传。
预览—
当前样式
导出按 devicePixelRatio=2 渲染,插入文档时不会发虚。
How to Use
📖 What it does
Screenshots of code are often blurry, carry editor chrome and leak file paths. This tool re-typesets your snippet with a monospace font, a chosen palette, optional line numbers and window chrome, then renders a clean high resolution image.
Rendering happens in a local canvas with no external service. Edit font size or theme and the preview reflows instantly; export renders at twice the pixel density so it stays sharp in slides and articles.
Forty lines at 1200x630 with 2x export take about 0.2 s from click to file. Syntax colouring scans rows and draws once, so no DOM node is created per character and long code does not bloat the page.
Switching language recolours without re-laying out the canvas, and export goes through toBlob, so repeated exports do not stack canvases and the preview keeps the latest style.
The workspace exposes 11 controls, from 语言 to 窗口装饰, and every one of them only affects the local rendering: nothing is sent back to a server.
Ranges and defaults: 语言 (JavaScript / TypeScript / Python / Go / PHP), 主题 (纸白 · Paper / 浅灰 · Slate / 暖米 · Sand / 深蓝 · Navy), 字号 (11–20(默认 14)), 内边距 (16–64(默认 28)), 圆角 (0–20(默认 10)). Values outside the slider range are rejected rather than silently clamped.
The 语言 control is a dropdown with the options JavaScript / TypeScript / Python / Go / PHP; the active option is what the export uses, so check it after every reload.
The 主题 control is a dropdown with the options 纸白 · Paper / 浅灰 · Slate / 暖米 · Sand / 深蓝 · Navy; the active option is what the export uses, so check it after every reload.
The 字号 control is a slider with the range 11–20(默认 14); every step redraws the result, so you can compare two neighbouring values without guessing.
The 内边距 control is a slider with the range 16–64(默认 28); every step redraws the result, so you can compare two neighbouring values without guessing.
The 圆角 control is a slider with the range 0–20(默认 10); every step redraws the result, so you can compare two neighbouring values without guessing.
✨ Features
- Six palettes: three light and three dark, with matched foreground and comment colours.
- Seven highlighters: JavaScript/TypeScript, Python, Go, PHP, SQL, JSON and Bash.
- Layout controls: font size, padding, line numbers, window dots, language label, radius and shadow.
- Live preview within 200 ms; long lines widen the canvas instead of being clipped.
- 2x PNG export, plus copy the image to the clipboard.
- Theme and layout choices are remembered locally.
🚀 How to use
- Paste code into the editor, or load the sample.
- Pick language, theme, font size and padding; toggle line numbers, chrome and shadow.
- Watch the preview update; long code widens the canvas instead of wrapping.
- Export PNG or copy the image, then paste it into your document.
- Change options and export again at any time; your code is never modified.
⚠️ Before you rely on it
- Regex highlighting: tokens are matched by keyword tables, not parsed, so nested template literals or regex literals may colour oddly.
- Fonts depend on the system: the mono stack resolves differently per OS, so exported glyphs vary slightly.
- Very long lines widen the image: wrap lines beyond 200 characters first.
- Keep under 80 lines: taller images get scaled down when inserted.
- Export is 2x: sharper but larger; compress afterwards if size matters.
- Nothing is uploaded: everything renders locally.
Questions people ask: Q: Some keywords are not coloured A: That language keyword table does not cover them; highlighting is cosmetic and the code stays copyable. Q: Can I enlarge the exported image? A: It is already 2x; for larger output raise the font size and export again. Q: Does HTML work? A: Yes, but it is coloured with the JS rules and tags appear as plain text. Q: Does long code get cut off? A: Past 80 rows the font shrinks automatically and can still overflow. Split the snippet, or set the font size to 12 px before exporting.
Typical use: A clean code figure for technical documentation without editor chrome. Consistent code screenshots for a blog or newsletter. High resolution snippets for slides.
What you can enter: Plain text, ideally under 80 lines and 200 characters per line. Language among JS/TS, Python, Go, PHP, SQL, JSON and Bash. Font size 11 to 20 px, padding 16 to 64 px, line numbers and chrome toggles, radius 0 to 20 px.
What you get back: A PNG rendered at 2x, named like code-js-20261119-1042.png. Copy as PNG to the clipboard is also available.
Limits to keep in mind: No syntax tree analysis, so unusual constructs may colour incorrectly. Glyphs depend on the local font stack. No GIF, video or interactive code block export.