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.

61 lines
1.2 KiB

14 years ago
// gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)
/**
* Module dependencies.
*/
var Stream = require('stream').Stream;
13 years ago
/**
* Constructor.
*
* @param {String|Number} path - path to img source or ReadableStream or width of img to create
* @param {Number} [height] - optional filename of ReadableStream or height of img to create
13 years ago
* @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);
}
if(source instanceof Stream) {
this.sourceStream = source;
source = height || 'unknown.jpg';
} else if (height) {
13 years ago
// new images
width = source;
source = "";
13 years ago
this.in("-size", width + "x" + height);
13 years ago
if (color) {
13 years ago
this.in("xc:"+ color);
13 years ago
}
}
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;
13 years ago
module.exports.version = "0.5.0";