Simple DynImage structure and command-line API
[Dynartic.git] / main.js
1 /*
2 * Dynartic main.js
3 * Performs the bulk of the operation for Dynartic
4 * Dynartic is a tool for automatically generating beautiful yet abstract art
5 * Think of it as Lorem Ipsum for images
6 */
7
8 var fs = require("fs");
9 var Png = require("png").Png;
10 var DynImage = require("./DynImage");
11
12 // fetch configuration values
13 // TODO: better way of doing this, maybe
14 var width = process.argv[2]*1;
15 var height = process.argv[3]*1;
16
17 // buffer size is: width * height * 4 (RGBA is 4 bytes)
18 var buffer = new Buffer(width * height * 4);
19
20 // bare calculations are offset to DynImage
21 var dynimage = new DynImage(width, height, buffer);
22
23 var png = new Png(buffer, width, height, 'rgba');
24 png.encode(function(image) {
25 fs.writeFile("output.png", image);
26 });
This page took 0.075821 seconds and 5 git commands to generate.