sindresorhus/term-img
关于
Display images in iTerm
设计与媒体实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文term-img
Display images in terminals using the iTerm inline image protocol
You probably want the higher-level terminal-image package for displaying your images.

Even animated gifs!
Currently only supported on iTerm >=3, WezTerm, Konsole, Rio, and VSCode integrated terminal.
Install
npm install term-img
Usage
import terminalImage from 'term-img';
function fallback() {
// Return something else when not supported
}
console.log(terminalImage('unicorn.jpg', {fallback}));
API
terminalImage(image, options?)
Get the image as a string that you can log manually.
image
Type: string | Uint8Array
File path to an image or an image as a buffer.
options
Type: object
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.
Related
- term-img-cli - CLI for this module
- term-kitty-img - Similar package but for Kitty, Konsole, WezTerm
探索相关项目
加载中…