Skip to content

[Forked] - To add display image from url - Display images in the terminal

License

Notifications You must be signed in to change notification settings

fkanout/terminal-image

 
 

Repository files navigation

terminal-image Build Status

Display images in the terminal

Works in any terminal that supports colors.

In iTerm, the image will be displayed in full resolution, since iTerm has special image support.

Install

$ npm install terminal-image

Usage

const terminalImage = require('terminal-image');

(async () => {
	console.log(await terminalImage.file('unicorn.jpg'));
})();

// Image from url
(async () => {
	console.log(await terminalImage.url('https://www.host.com/img.jpg'));
})();

API

Supports PNG and JPEG images.

terminalImage.buffer(imageBuffer)

Returns a Promise<string> with the ansi escape codes to display the image.

imageBuffer

Type: Buffer

Buffer with the image.

terminalImage.file(filePath)

Returns a Promise<string> with the ansi escape codes to display the image.

filePath

Type: string

File path to the image.

Related

License

MIT © Sindre Sorhus, Faisal KANOUT

About

[Forked] - To add display image from url - Display images in the terminal

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%