A somewhat updated fork from GraphicsMagick for node
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.0 KiB

14 years ago
// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
13 years ago
/**
* Constructor.
*
* @param {String|Number} path - path to img source or width of img to create
* @param {Number} [height] - optional height of img to create
* @param {String} [color] - optional hex background color of created img
*/
function gm (source, height, color) {
var width;
if (!(this instanceof gm)) {
return new gm(source, height, color);
}
this.data = {};
this._in = [];
this._out = [];
14 years ago
13 years ago
if (height) {
// new images
width = source;
source = "";
13 years ago
var arg = ["-size", width + "x" + height];
13 years ago
if (color) {
arg = arg.concat(['"xc:'+ color + '"']);
}
13 years ago
this.arg(arg);
}
13 years ago
this.source = source;
}
13 years ago
/**
* Augment the prototype.
*/
require("./lib/getters")(gm.prototype);
require("./lib/args")(gm.prototype);
require("./lib/drawing")(gm.prototype);
require("./lib/convenience")(gm.prototype);
require("./lib/command")(gm.prototype);
/**
* Expose.
*/
module.exports = gm;