# term-img2

> Display images in your terminal

Latest version **2.0.1** (published 2016-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install term-img2
pnpm add term-img2
yarn add term-img2
bun add term-img2
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2016-04-14 |
| First published | 2016-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | EGOIST |
| Maintainers | kchan |
| Keywords | term, image, iterm, iterm2, terminal, shell, console, command-line, img, pic, picture, photo, app, version, ansi, escape, gif, gifs, jpg, jpeg |

## Links

- npm: https://www.npmjs.com/package/term-img2
- Repository: https://github.com/egoist-robot/term-img2
- Homepage: https://github.com/egoist-robot/term-img2#readme
- Issues: https://github.com/egoist-robot/term-img2/issues
- npm.io page: https://npm.io/package/term-img2

## Dependencies (2)

- [ansi-escapes](https://npm.io/package/ansi-escapes.md) ^1.3.0
- [iterm2-version](https://npm.io/package/iterm2-version.md) ^2.1.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2016-04-14
- 2.0.0 — 2016-04-14

## README

# term-img2

> Display images in your terminal

![](screenshot.jpg)

Even [animated gifs](https://github.com/vdemedes/gifi)!

*Currently only supported on [iTerm >=2.9](https://www.iterm2.com/downloads.html).*


## Install

```
$ npm install --save term-img2
```


## Usage

```js
const termImg = require('term-img2');

termImg('unicorn.jpg', {log: true});
```


## API

### termImg(input, [options])

#### input

Type: `string` `buffer`

Filepath to an image or an image as a buffer.

#### options

##### width
##### height

Type: `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`<br>
Default: `true`

##### log

Type: `boolean`<br>

Log image in terminal, `false` by default.

##### fallback

Type: `function`<br>
Default: `() => throw new UnsupportedTerminal()`

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

#### return

Type: `string`<br>
The image string that can be displayed in terminal.

## Related

- [imgcat](https://github.com/egoist/imgcat) - CLI for this module


## License

MIT © [EGOIST](https://github.com/egoist)

---
_Source: https://npm.io/package/term-img2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
