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

A Node.JS module that converts images to ASCII art.
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
const 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 example
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): Iftrue
, the pixels will be reversed (default:false
).colored
(Boolean): Iftrue
, the result will be colored (default:true
).aRatio
(Boolean): Iftrue
, the aspect ratio will be kept (default:false
).imageMagick
(Boolean): Iftrue
, ImageMagick will be used instead ofGraphicsMagick
(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. ✨
image-to-js
by yutouimgurize
by Michael Kaminskyjs2image
by yutounrk-tv-cli
by Hans Kristian Flaattensalestock-cli
by Muhammad Mustadi