JSPM

img-term-string

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q35682F
  • License ISC

Loads and processes image data from url/file to display it in the terminal

Package Exports

  • img-term-string

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (img-term-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

img-term-string

Transforms image to a string that can be rendered inline in the terminal.

Currently supported on iTerm2 >= 3.

Install

$ npm install --save img-term-string

Usage

const imgTermString = require('img-term-string');

imgTermString({ src: 'https://media.giphy.com/media/gx54W1mSpeYMg/giphy.gif' })
    .then(imgString => {
        console.log(imgString);
    });

imgTermString({ 
    src: './ohno.jpg' 
    width: 'auto', 
    height: '200px'
}, imgString => {
    console.log(imgString);
    // Prints the img inline to the terminal. 
})

Usage

imgTermString(options)

Returns a the formatted image string via promise or callback.

src

Type: string

The url or file path of the image.

width

height

Type: string number Default: auto Options: Npx N% N auto

Optional arguments. Set the width and height of the image.

  • in pixels(Npx)
  • as a % of the terminal view(N%)
  • number of char cells(N)
  • autoscale based on the image dimensions(auto).

License

MIT ©