JSPM

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

Node.js module that converts a PNG image 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

Node.js module that converts an image to ASCII art.

How to use

Constructor: new ImageToAscii (options)

options is an object containing the following fields:

  • pixels: string representing the ASCII pixels in the brightness order. If not provided, the default value will be used: " .,:;i1tfLCG08@"
  • multiplyWidth: the width of the ASCII pixles. For keeping the aspect ratio in terminal, the default value is 2
  • reverse: boolean value that indicates if the pixels value must be reversed. Default is undefined.
  • colored: boolean value that indicates if the ASCII art must be colored or not. Default is undefined.

.convert (imagePath, callback)

  • imagePath: the path to the PNG image
  • callback: the callback function

Example

var ImageToAscii = require ("../index")
  , myImage = new ImageToAscii ({
        resize: {
            height: "100%"
          , width:  "50%"
        }
      , multiplyWidth: 1
      , colored: true
    })
  ;

myImage.convert(__dirname + "/octocat.png", function(err, converted) {
    console.log(err || converted);
});

Baracktocat + image-to-ascii = Nice ASCII art 😃

Test

Changelog

v0.1.1

  • Added support for images from Internet

v0.1.0

  • Initial version

License

See LICENSE file