npmisgood-ansi-image

1.1.6 • Public • Published

ATIF, Ansi Two hundred-fifty-six colors Image Format (ANSI-IMAGE)

256 colors image for console.

Usage

Load image:

var ai = require("npmisgood-ansi-image");
var fs = require("fs");
ai(fs.readFileSync("image.atif"),(d)=>console.log(d));

Generate image:

var tmp = new ai.template(10/*width*/,10/*height*/);
tmp.plot(0/*x*/,0/*y*/,1/*number for color of palette*/); //x/y starts at 0
tmp.palette.push(0);
tmp.palette.push(0xFF); //0 is for black, 0xFF(255) is for white
tmp.out2file("image.atif");

Format

Line 1: Symbol for ATIF(7F 41 49)

Line 2~4: Header

  • Line 2: Number for how long is palette, it is often 1
  • Line 3~: Palette
  • Line 3+n~: Number for how long is art

Line 4+n~: Art

Package Sidebar

Install

npm i npmisgood-ansi-image

Weekly Downloads

1

Version

1.1.6

License

CC-BY-ND-4.0

Unpacked Size

11.6 kB

Total Files

8

Last publish

Collaborators

  • npmisgood