npmisgood-ansi-image
v1.1.6
Published
Image format for console
Downloads
9
Maintainers
Readme
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
