Home / nodejs / npmisgood-ansi-image
Name Modified Size InfoDownloads / Week
Parent folder
images 2020-10-18
dist 2020-10-18
README.md 2020-10-18 719 Bytes
index.js 2020-10-18 4.4 kB
package.json 2020-10-18 1.2 kB
test.js 2020-10-18 95 Bytes
Totals: 6 Items   6.4 kB 0

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

Source: README.md, updated 2020-10-18