Screenshot console output
Alternatives To Sh2png
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Html2canvas28,8611,7322,180a day ago42January 22, 2022947mitTypeScript
Screenshots with JavaScript
Karma Nightmare5352193 years ago38March 25, 201818JavaScript
⚡ A Karma plugin. Launcher for Nightmare
Leaflet Simple Map Screenshoter49
10 months ago15mitJavaScript
Leaflet plugin which take screenshot of map
Screenshot Tweet44
25 years ago8September 26, 20183mitJavaScript
Screenshot a Twitter tweet.
React Native Waterflow List16
3 years ago9March 23, 20211mitTypeScript
6 years ago5November 24, 2017mitJavaScript
A Storybook CSS regression utility based on headless Chrome.
Wd Screenshot4
8 years ago1mitJavaScript
Puppeteer Screenshot3
5 years ago1JavaScript
A screenshot tool with puppeteer
7 years ago2mitJavaScript
js client for spectre
7 years ago2mitCoffeeScript
Screenshot console output
Alternatives To Sh2png
Select To Compare

Alternative Project Comparisons

Shell to PNG

Tools exist to screenshot websites, but why aren't there tools to screenshot console contents?

Add sample usage to your README as part of your build system, keep a tutorial's command line examples updated, or easily create a bug report without as much copy/paste.

And yes, the tool is compatible with all shells and many image formats, despite it's misleading name.

npm Build Status

Sample Output

Mocha's output

This image was created by passing the result of calling Mocha into sh2png.format.

See for the test that produced the output above. See the results of testing sh2png for other examples.


As per usual for Node applications, sh2png follows Semantic Versioning. See the CHANGELOG for information about each release.

For stability, minor versions are used if either

  • internal (private) methods are altered to have a different API
  • bugs are fixed that people might rely on

What does this mean? Lock down your minor number for sh2png in package.json if you:

  • Use images outputted sh2png in testing, where us fixing a pixel will break your test
  • Extend the sh2png class, and depend on the internal method signatures
  • Are building a core utility, which might have users in one of the above categories.

Otherwise, upgrading to the latest minor version or patch should be safe, as the public API should remain the same.

Either way, consider subscribing to an ATOM feed of our releases, so you can be notified about new versions.


Install via NPM.

Don't have NPM? Grab NodeJS or Node Version Manager.

npm install [--save-dev] sh2png

Console Usage

You can pipe text to sh2png on the command line. See sh2png --help for more information.

sh2png --help

(Created via sh2png --help | sh2png - > help.png)

Install the CLI utility globally across your entire computer via npm install -g sh2png, or access a locally installed binary via $(npm bin)/sh2png.

Node.js Usage

Formatting Strings

Got some text from the console? Call sh2png.format to turn a string of console text into an image. format returns a Promise.

Don't want to use Promises? Here's some standard NodeJS code.

sh2png = require("sh2png");
exec = require("child_process").exec;
env = process.env;
env.force_color_prompt = "yes";

exec("mocha", {env: env}, function (err, stdout, stderr) {
  // handle error
    .then(function (img) {
      img.write(__dirname + "mocha_output.png", function(err) {
        // handle error
    .catch(function (err) {
      // handle error

Want to use Promises? (Example in CoffeeScript)

sh2png = require "sh2png"
{exec} = require "child-process-promise"
env = process.env
env.force_color_prompt = "yes"

exec "mocha", {env}
  .then ({stdout}) ->
    sh2png.format stdout
  .then (img) ->
    img.writeAsync "#{__dirname}/mocha_output.png"
  .then ->
    # image written
  .catch (err) ->
    console.log err

See documentation for sh2png.format for more information.

Extending sh2png

If you want to extend sh2png, you're in luck. The source is object oriented, with documentation for each method. Simply override the methods you want to replace, and you're good to go!

Popular Screenshot Projects
Popular Promise Projects
Popular Media Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.