Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including term-img with all npm packages installed. Try it out:

var termImg = require("term-img")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

term-img v5.0.0

Display images in iTerm

term-img Build Status

Display images in iTerm

You probably want the higher-level terminal-image package for displaying your images.

Even animated gifs!

Currently only supported on iTerm >=3.


$ npm install term-img


const termImg = require('term-img');

function fallback() {
    // Return something else when not supported

console.log(termImg('unicorn.jpg', {fallback}));


termImg(image, options?)

Get the image as a string that you can log manually.


Type: string | Buffer

Filepath to an image or an image as a buffer.


Type: object


Type: 'auto' | string | number

The width and height are given as a number followed by a unit, or the word 'auto'.

  • N: N character cells.
  • Npx: N pixels.
  • N%: N percent of the session's width or height.
  • auto: The image's inherent size will be used to determine an appropriate dimension.

Type: boolean
Default: true


Type: Function
Default: () => throw new UnsupportedTerminalError()

Enables you to do something else when the terminal doesn't support images.



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free