JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 577
  • Score
    100M100P100Q93388F
  • License KINDLY

A Node.JS module that converts images to ASCII art.

Package Exports

  • image-to-ascii

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (image-to-ascii) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

image-to-ascii

image-to-ascii Support this project

A Node.JS module that converts images to ASCII art.

image-to-ascii

Installation

Install Graphics Magick.

# Ubuntu
$ sudo apt-get install graphicsmagick

# Fedora
$ sudo dnf install GraphicsMagick

# OS X
$ brew install graphicsmagick

# Chocolatey (package manager for Windows)
# (Restart of cmd/PowerShell is required)
$ choco install graphicsmagick

Then, you can install this package:

$ npm i image-to-ascii

Example

// Dependencies
var ImageToAscii = require("image-to-ascii");

// Convert to ascii this image
ImageToAscii(__dirname + "/octocat.png", function(err, converted) {
    console.log(err || converted);
});

In order to run the webcam.sh provided in the test folder, you will also need streamer. The script uses streamer to make webcam pictures and converts them into ASCII art using the webcam.js

# Ubuntu
$ sudo apt-get install streamer

To run the script just use:

sh webcam.sh

Documentation

ImageToAscii(options, callback)

Converts the provided image in ASCII art.

Params

  • Object|String options: The path to the image or an object containing the following fields:
  • path (String): The path to the image.
  • pixels (String|Array): The pixels that will be used to render the ASCII image (default: " .,:;i1tfLCG08@").
  • pxWidth (Number): The pixel width used for aspect ratio (default: 2).
  • reverse (Boolean): If true, the pixels will be reversed (default: false).
  • colored (Boolean): If true, the result will be colored (default: true).
  • aRatio (Boolean): If true, the aspect ratio will be kept (default: false).
  • size (Object): The size of the result image (ASCII art):
    • height (Number|String): The height value (default: "100%").
    • width (Number|String): The width value (default: computed value to keep aspect ratio).
  • Function callback: The callback function.

How to contribute

Have an idea? Found a bug? See how to contribute.

Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

License

KINDLY © Ionică Bizău