Popularity
3.2
Growing
Activity
3.2
Declining
265
6
11

Monthly Downloads: 0
Programming language: JavaScript
License: MIT License
Tags: Ansi     Command Line Utilities     Image     Console     App     Term     Terminal     Version     Gif     Command-line     Escape     Shell     Jpeg     Jpg     Picture     Pic     Gifs     Photo     Img     Iterm2     Iterm    
Latest version: v4.1.0

term-img alternatives and similar modules

Based on the "Command Line Utilities" category

Do you think we are missing an alternative of term-img or a related project?

Add another 'Command Line Utilities' Module

README

term-img Build Status

Display images in iTerm

[](screenshot.jpg)

Even animated gifs!

Currently only supported on iTerm >=3.

Install

$ npm install term-img

Usage

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

function fallback() {
    // Do something else when not supported
}

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

API

termImg(image, [options])

Log the image to the terminal directly.

termImg.string(image, [options])

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

image

Type: string | Buffer

Filepath to an image or an image as a buffer.

options

width
height

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.
preserveAspectRatio

Type: boolean Default: true

fallback

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

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

License

MIT © Sindre Sorhus


*Note that all licence references and agreements mentioned in the term-img README section above are relevant to that project's source code only.