typo-image

Typo-image is an ANSI image plugin for typo - draw images into command-line (CLI)!

npm install typo-image
6 downloads in the last week
12 downloads in the last month

Typo-image

The typo plugin to draw an image in command-line (CLI)!

screenshot

Installation

npm install typo --save
npm install typo-image --save

Typo-image only supports 8-bit png(png-8) file so far.

Maybe someday typo-image will support any image format using ImageMagick. But I really doesn't have much spare time.

Demo

An available demo is located at 'demo/typo-image.js':

node demo/typo-image.js

Usage

var typo = require('typo')({
    output: process.stdout
});
typo.plugin( require('typo-image') );

// pay attension, this.is an async method 
typo.log('{{~image ./icon.png}}');

Be free to print an image for many times, typo-image will cache the result. You could also save your output by using typo.template().

And there are also bunch of options to help you manage your image:

typo.log('{{~image:options ./icon.png}}', {
    options: {
        indent: 4
    }
});

~image

'~' is one of the typo conventions used to idenfity an asynchronous helper.

Syntax

typo.log(
    '{{~image[:<options>] <image_path>}}', 
    [<substitution>], 
    [<callback>]
);

Available options

(what's coming...)

width

Number

no support so far

height

Number

no support so far

indent

Number

supported

pixel_size

Number

supported

cache

Boolean

supported

cache_output

Path

supported

npm loves you