# ascii-art-image

> ``` _ _ _ (_)(_) | | __ _ ___ ___ _ _ ______ __ _ _ __ | |_ / _` |/ __| / __|| || ||______| / _` || '__|| __| | (_| |\__ \| (__ | || | | (_| || | | |_ \_

Latest version **1.4.0** (published 2021-05-17) · 0 weekly downloads

## Install

```sh
npm install ascii-art-image
pnpm add ascii-art-image
yarn add ascii-art-image
bun add ascii-art-image
```

## 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 | 1.4.0 |
| Published | 2021-05-17 |
| First published | 2019-08-18 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | khrome |

## Links

- npm: https://www.npmjs.com/package/ascii-art-image
- npm.io page: https://npm.io/package/ascii-art-image

## Dependencies (2)

- [canvas](https://npm.io/package/canvas.md) ^2.6.0
- [ascii-art-braille](https://npm.io/package/ascii-art-braille.md) 0.1.0

## Recent versions

- 1.4.0 (latest) — 2021-05-17
- 1.3.6 — 2021-05-02
- 1.3.5 — 2021-04-27
- 1.3.4 — 2021-04-25
- 1.3.3 — 2021-04-25
- 1.3.2 — 2021-04-25
- 1.3.1 — 2021-04-25
- 1.3.0 — 2021-04-15
- 1.2.2 — 2019-12-23
- 1.2.1 — 2019-12-23
- 1.2.0 — 2019-12-07
- 1.1.0 — 2019-12-04
- 1.0.2 — 2019-11-17
- 1.0.1 — 2019-11-15
- 1.0.0 — 2019-10-28
- … 5 more at https://npm.io/package/ascii-art-image/versions

## README

```
                   _  _                       _
                  (_)(_)                     | |
  __ _  ___   ___  _  _  ______   __ _  _ __ | |_
 / _` |/ __| / __|| || ||______| / _` || '__|| __|
| (_| |\__ \| (__ | || |        | (_| || |   | |_
 \__,_||___/ \___||_||_|         \__,_||_|    \__|
```

ascii-art-image.js
==================

[![NPM version](https://img.shields.io/npm/v/ascii-art-image.svg)]()
[![npm](https://img.shields.io/npm/dt/ascii-art-image.svg)]()
[![Travis](https://img.shields.io/travis/khrome/ascii-art-image.svg)]()


Installation
------------

npm install ascii-art-image


Usage
------

<a name="module_ascii_art_image_top"></a>
### require('ascii-art-image')
To do anything with it, you'll need to include the library:

```javascript
const Image = require('ascii-art-image');
```

* [ascii-art-image](#module_ascii_art_image) ⇒ <code>AsciiArtImage</code>
* [Image.create(ansi_string, handler)](#module_ascii_art_image.create) ⇒ <code>Promise</code>(If callback not provided)


<a name="module_ascii_art_image"></a>
### new Image(options)
the constructor takes an options argument

**Kind**: static property of <code>[ascii-art-image](#ascii-art-image)</code>

| Param | Type | Description |
| --- | --- | --- |
| options | <code>Object</code> | the set of options being passed |
| options.alphabet | <code>string</code> | characters used to draw the image. One of: `variant1`, `variant2`, `variant3`, `variant4`, `ultra-wide`, `wide`, `hatching`, `bits`, `binary`, `greyscale`, `blocks` |
| options.filepath | <code>string</code> | The path of the image |
| options.width | <code>Int</code> | The width to render the image |
| options.height | <code>Int</code> | The height to render the image |
| options.distance | <code>function</code> | a function which takes in 6 args (2x rgb) and returns a measure of distance between these two colors |

**Examples**


<a name="module_ascii_art_image.create"></a>
### Image.create(options, callback)
Map through an ansi string one character at a time, without any of those characters being styles.

**Kind**: static property of <code>[ascii-art-image](#ascii-art-image)</code>

| Param | Type | Description |
| --- | --- | --- |
| options | <code>Object</code> | the set of options being passed |
| options.alphabet | <code>string</code> | characters used to draw the image. One of: `variant1`, `variant2`, `variant3`, `variant4`, `ultra-wide`, `wide`, `hatching`, `bits`, `binary`, `greyscale`, `blocks` |
| options.filepath | <code>string</code> | The path of the image |
| options.width | <code>Int</code> | The width to render the image |
| options.height | <code>Int</code> | The height to render the image |
| options.distance | <code>function</code> | a function which takes in 6 args (2x rgb) and returns a measure of distance between these two colors |

**Examples**

for example, say we want to generate a copy of a metropolis poster:

![Image Output](http://patternweaver.com/Github/Ascii/docs/metropolis.jpg)

You just need to do something like this:

```js
var Image = require('ascii-art-image');

var image = new Image({
    filepath: '~/Images/metropolis.jpg',
    alphabet:'variant4'
});

image.write(function(err, rendered){
    console.log(rendered);
})
```

![Image Output](http://patternweaver.com/Github/Ascii/docs/metropolis.png)

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