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.
$ npm install terminal-image
const terminalImage = require('terminal-image');
(async () => {
console.log(await terminalImage.file('unicorn.jpg'));
})();
Supports PNG and JPEG images.
Returns a Promise<string>
with the ansi escape codes to display the image.
Type: Buffer
Buffer with the image.
Returns a Promise<string>
with the ansi escape codes to display the image.
Type: string
File path to the image.
const terminalImage = require('terminal-image');
const got = require('got');
(async () => {
const {body} = await got('sindresorhus.com/unicorn', {encoding: null});
console.log(await terminalImage.buffer(body));
})();
- terminal-image-cli - CLI for this module
- terminal-link - Create clickable links in the terminal
- chalk - Style and color text in the terminal
MIT © Sindre Sorhus