Code Screenshot & Code Snapshot (Copy Code as Image, PNG/SVG)

Code Screenshot & Code Snapshot (Copy Code as Image, PNG/SVG), a VS Code extension by Zovo

Code screenshot and code snapshot in one key: select code, press Cmd+Alt+C (Shift+Alt+C) and a PNG of it is on your clipboard, in your editor theme, font and colors. Save PNG or SVG, line numbers, highlights, window frame, backgrounds. Free, no sign-in, works offline.

Install in VS CodeOpen the Marketplace page

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.zovo-code-screenshot, version 0.2.1.

Select code, press Cmd+Alt+C (Shift+Alt+C on Windows and Linux), and a PNG of it is on your clipboard. It is drawn with your editor theme, font, size, ligatures and bracket colors. Free, no sign-in, works offline.

VS Code with lines 4 to 22 of app.ts selected. The Code Screenshot panel beside the editor shows the picture of those lines in a window frame on a purple gradient, and the note "Copied the PNG (1512 × 1100 px) to the clipboard." The status bar says "Code Screenshot: PNG copied (1512 × 1100 px)".

Real output from VS Code 1.142 on macOS: the packaged extension in a clean profile, the shortcut pressed through the debug port by scripts/e2e-vscode.mjs. The picture below is the PNG it put on the clipboard.

The PNG that was copied: lines 4 to 22 of app.ts in the Dark Modern colors, with line numbers 4 to 22, three window dots and the title app.ts, on a purple to teal gradient.

Quick start

  1. Select the lines you want. Partial lines are fine: whole lines are taken, so the indent is right.
  2. Press Cmd+Alt+C (Shift+Alt+C), or right-click and pick Copy as Image (PNG).
  3. Paste into a chat, an issue, a doc or a slide.

"Code Screenshot: Get Started" in the Command Palette opens a short tour.

Questions people ask

Is Code Screenshot & Code Snapshot (Copy Code as Image, PNG/SVG) free?

Yes. Code Screenshot & Code Snapshot (Copy Code as Image, PNG/SVG) is free and MIT licensed.

How do I install Code Screenshot & Code Snapshot (Copy Code as Image, PNG/SVG)?

Click "Install in VS Code" above, or search for zovo.zovo-code-screenshot in the Extensions view.

What you can change

The panel with Options open: line numbers, frame, title, background, padding, shadow, corners, remove common indent, wrap, font size and mark text. In the picture of lines 9 to 15, line 10 is highlighted, the word "hit" is marked by a double-click and both "this" are marked from the Mark text box.
OptionWhat it does
Copy PNG, Save PNG, Save SVG, Copy SVGPNG at 1x, 2x, 3x or 4x. SVG keeps the code as text, so it is sharp at any size and the text can be selected.
Line numbersThe real line numbers from the file, so line 40 says 40.
Highlight linesClick a line in the picture to highlight it, Shift+click for a range.
Mark a wordDouble-click a word in the picture, or type it in Mark text to mark every match.
FrameA window with three dots, a plain window, or no window. The title is the file name or your own text.
BackgroundFive gradients, one color, the editor color, or transparent (PNG and SVG keep the transparency). Padding, shadow and rounded corners.
Remove common indentA nested block starts at the left edge. The indent inside it stays. Tabs become spaces at your tab size.
Wrap at N columnsLong lines wrap and keep their indent. Off by default, so nothing is stretched or squeezed.
Folded code and gapsA folded region is one "folded lines" row. With several selections, the lines between them are one "⋯" row.

Your choices are kept for the next picture. Settings (codeScreenshot.*) give the defaults.

Saving files

Save PNG and Save SVG name the file after the lines, for example app.ts-L12-L40.png, and open the folder you saved to last. Set codeScreenshot.saveFolder (you can use ~ and ${workspaceFolder}) to always use one folder. Turn off codeScreenshot.askWhereToSave to save at once without the dialog.

Themes

The same lines 4 to 22 copied in the Light Modern theme: white window, purple and blue keywords, dark blue names, brown and green brackets.

The picture follows the theme you use, including high contrast themes and themes from the Marketplace. Change the theme and the open panel draws again.

Large selections and minified files

Code Screenshot reads only the lines you selected, plus up to 3,000 lines before them so a comment or string that starts earlier is colored right. It never loads the whole file into the extension.

Remote windows, WSL and the browser

In Remote SSH, WSL and Dev Containers windows the extension runs on your own computer (it asks for the UI side first), so the clipboard is yours. In a browser (for example code-server), the panel copies the image itself; if the browser does not allow it, it offers Save PNG.

SystemClipboard command
macOSosascript (built in)
WindowsPowerShell (built in)
Linuxxclip on X11, wl-copy (wl-clipboard) on Wayland

Privacy

No account, no telemetry, no network. The panel's content security policy blocks every remote source, code is drawn with DOM text nodes (so <script> in your code is just text), and the extension makes no network calls. The rating question and the Sponsor links sit in the panel, never in the picture, and can be turned off.

Settings

SettingDefault
codeScreenshot.scale2PNG scale 1 to 4
codeScreenshot.lineNumberstrueLine numbers
codeScreenshot.framemacmac, plain or none
codeScreenshot.showTitletrueFile name in the frame
codeScreenshot.backgroundgradient-1Gradients, solid, editor, transparent
codeScreenshot.backgroundColor#6c5ce7Color for solid
codeScreenshot.padding48Space around the window
codeScreenshot.shadowtrueWindow shadow
codeScreenshot.cornerRadius10Rounded corners
codeScreenshot.removeCommonIndenttrueMove a nested block to the left edge
codeScreenshot.wrapColumn0Wrap at N columns (0 is off)
codeScreenshot.fontFamily(editor font)Another font for pictures only
codeScreenshot.maxLines1000Line limit
codeScreenshot.maxLineLength1000Characters per line
codeScreenshot.whenNothingSelectedvisiblevisible lines or the whole file
codeScreenshot.saveFolder(last folder)Folder for saved files
codeScreenshot.askWhereToSavetrueShow the save dialog
codeScreenshot.followSelectiontrueUpdate the open panel when you select other lines

Limits

License

MIT

Guides

Install Code Screenshot & Code Snapshot (Copy Code as Image, PNG/SVG)

Click the button to open VS Code and install it, or press Ctrl+P (Cmd+P on macOS) in VS Code and run ext install zovo.zovo-code-screenshot.

Free, MIT license. Needs VS Code 1.90.0 or newer. Extension ID zovo.zovo-code-screenshot, version 0.2.1.

Source code and issues are on GitHub.

All our VS Code extensions

Support this work

If this extension saves you time, you can support the work on GitHub Sponsors. Monthly tiers start at $5, and one-time tiers start at $15. Sponsorship is optional, and the tool works the same without it.

Need your format supported?

Open a format request with a sample file, and I reply there whether it can be done. For USD 299 once, through this GitHub Sponsors tier, I add your file format or a missing feature to this extension, with tests, within 7 days.