William Imoh
This tutorial is out of date and no longer maintained.
At some point behind that screen, you’ll need to capture an image of code - whether it’s yours or someone else’s. This could be for different reasons; reference for an article, asking for help from a forum, showing off on Twitter, or even storing valuable tidbits that you’d like to go through later. Either way, the importance of screenshot tools cannot be overemphasized right now because like it or not, we could all use one.
After some digging, here are six awesome ways to take screenshots of your code. Let’s look in!
Polacode is a Visual Studio Code extension that lets you create unique and sharable screenshots of your code. While using Polacode, it retains your existing theme and fonts and renders them for an awesome layout. Check this out:
In the screenshot above, Polacode effectively handles the shadow, padding and rounded corner of my Mac OS’s screenshot and hides stuff like color decorators, folding markers, and scrollbars.
Open VS Code, on the menu select View then click on Command Palette. In the input box, enter Polacode and select from the drop-down menu. Polacode will be opened to the side of the editor.
Highlight and copy the code you would like to make a screenshot of. Click on the screenshot button below the box. You will be asked for a path to save. Choose a path and save your newly created screenshot.
Carbon is a free and open source library to create and share awesome images of your source code. Options available when using Carbon include the ability to change your color theme, the ability to select your preferred programming language, the ability to share a tweet of your code’s screenshot and customize stuff like image syntax, window style, background color, color theme and more.
There is absolutely no need to install Carbon on your PC, just visit its website here, paste your code and screenshot away!
To take a screenshot with Carbon, copy the code you want a screenshot of from your IDE or text editor, paste in Carbon’s text area and click on the Save Image button.
You can check out Carbon’s Github repository here. It has plugins for various editors and IDE’s. Just follow the outlined steps in the documentation. Should you want to use Carbon with either PhpStorm or any other JetBrains IDE, simply select the code and select Open in carbon.now.sh
from the context menu that you open by right-clicking the selected text.
Greenshot is a screenshot software tool that can be used not only by developers but also by project managers, testers, and technical writers. With Greenshot, users can screenshot an image and edit it using a built-in image editor or render a part of the image unreadable by blurring it. Key features of Greenshot include:
To install Greenshot, Windows users can navigate through Greenshot’s website and download it for free here. However, it’s quite different for Mac users as they have to install Greenshot via the iTunes store for $1.99.
After you’ve installed Greenshot, navigate to the lower right-hand corner of your desktop and click on the Greenshot icon. Choose the kind of screenshot you would like to take:
If you would like to tinker with Greenshot’s source code, you could check it out on Github.
Created by Functional Cave, CodeCool is a web application that allows you to take lightweight (as low as 7kb) snapshots of your basic code snippets. Key features include the ability to change the screenshot’s background color as well as increase or decrease the font size of the code.
Just like Carbon, you don’t have to install Codecool. Just navigate to its website here, paste your code and take a screenshot.
To take a screenshot with Codecool, copy the code you want a screenshot of from your IDE or text editor, paste it in Codecool’s text area and click on the Export Image button.
You can check out CodeCool’s source code on Github here.
Code Screenshots is a JetBrains plugin which is used to take screenshots of code on Jetbrains IDEs. It’s compatible with IntelliJ IDEA, PhpStorm, WebStorm, PyCharm, RubyMine, AppCode, CLion, GoLand, DataGrip, Rider, MPS and Android Studio.
To install Code Screenshots, download the plugin from the Jetbrains website here and follow the installation process.
How does it work? Select the code you want to make a screenshot of and press a hot-key (Ctrl+Alt+Shift+A by default) to make a screenshot of it. You could configure the hotkey settings to what suits you as well, navigate to Settings|Keymap to do this. After taking a screenshot, a “Save as Image” action is available which lets you save the screenshot as a PNG file.
You can also view the source code for Code Screenshots on Github here.
An app created for Windows users. With ShareX, not only can you capture your screen, you can also take screenshots of a large amount of code that scrolls thus removing any need to crop your captures. It also has tools for editing as well as multiple captures. ShareX can also be extended as a plugin to be used in your browser. You can check out Sharex’s source code on Github here.
To install ShareX, navigate to the website here, download the setup file and follow the installation prompt.
After installing, launch the application and on the menu bar, navigate to Capture. Choose from the available options in the submenu. Should you need to save every screenshot taken, remember to navigate to After image tasks on the menu and check the Save image to file option.
Other key features of ShareX include:
A good part of these awesome tools is that they are free to use. It would be worthwhile to check out all of them to determine which would be the perfect fit for your work. I might have failed to cover some of your favorite tools so if you’ve got any tool that you’d like to share please do not hesitate to do so in the comment section. Throw in more pros and cons if you can as well!
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!