Coder Social home page Coder Social logo

ascii-art-maker's Introduction

ascii-art-maker:
An ASCII art generator in node.js

Installation generate figlet
- Usage Usage
- Examples Examples

Installation

In the shell:
$ npm install ascii-art-maker

In your JavaScript:
const ASCII = require('ascii-art-maker')

generate

Usage

ASCII.generate(image, opts)
Returns a Promise that resolves with the ASCII art.

image is either a Jimp object or a path to the image
opts is an object with the following properties:

Property Value Description Default
width number The width, in output pixels, of the output. Note that each output pixel is two characters wide, so the width in characters will be twice this value. 64
height number The height, in characters, of the output. 64
grad "lbg" | "dbg" | string[] The gradient used in the output. Use 'lbg' for the default light background gradient and 'dbg' for the default dark background. If using an array, note that it goes from darkest to lightest. "lbg"
color boolean Whether or not to color the output. This uses ANSI escape codes. false

Examples

const ASCII = require('ascii-art-maker')
const log = async () => {console.log(
  ASCII.generate('./content/images/peppers.jpg', {
    width: 64, height: 64,
    grad: 'lbg',
    color: true,
  })
)}
log()

const ASCII = require('ascii-art-maker')
ASCII.generate('./content/images/lenna.jpg', {
  width: 128, height: 128,
  grad: 'dbg',
  color: false,
}).then(art => {console.log(art)})

figlet

Usage

ASCII.figlet(str, font)
Returns a Promise that resolves with the banner text.

str is a string
font is the path to a FIGlet font file (standard.flf is included with the package and is the default value)

Examples

const ASCII = require('ascii-art-maker')
const log = async () => {console.log(
  ASCII.figlet('hi there')
)}
log()

const ASCII = require('ascii-art-maker')
ASCII('figlet text', './small.flf')
  .then(art => {console.log(art)})

ascii-art-maker's People

Contributors

zombom avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.