Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gm

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gm - npm Package Compare versions

Comparing version 1.4.2 to 1.5.0

examples/append.js

2

examples/background.js
var gm = require('../')
, dir = __dirname + '/imgs'
gm(dir + "/original.jpg")

@@ -5,0 +5,0 @@ .crop(140,100)

1.5.0 / 2012-09-15
==================
* fixed; callback scope
* fixed; append() usage #77
1.4.2 / 2012-08-17

@@ -3,0 +9,0 @@ ==================

@@ -51,4 +51,4 @@ // gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)

// eg. "filename.gif[0]"
var frames;
if (frames = source.match(/(\[.+\])$/)) {
var frames = source.match(/(\[.+\])$/);
if (frames) {
this.sourceFrames = source.substr(frames.index, frames[0].length);

@@ -59,2 +59,10 @@ source = source.substr(0, frames.index);

this.source = source;
this.addSrcFormatter(function (src) {
// must be first source formatter
var ret = this.sourceStream ? '-' : this.source;
if (ret && this.sourceFrames) ret += this.sourceFrames;
src.length = 0;
src[0] = ret;
});
}

@@ -61,0 +69,0 @@

@@ -31,5 +31,54 @@ // gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)

// http://www.graphicsmagick.org/GraphicsMagick.html#details-append
proto.append = function append (ltr) {
return this.out(ltr ? "+append" : "-append");
/**
* Appends images to the list of "source" images.
*
* We may also specify either top-to-bottom or left-to-right
* behavior of the appending by passing a boolean argument.
*
* Examples:
*
* img = gm(src);
*
* // +append means left-to-right
* img.append(img1, img2) gm convert src img1 img2 -append
* img.append(img, true) gm convert src img +append
* img.append(img, false) gm convert src img -append
* img.append(img) gm convert src img -append
* img.append(img).append() gm convert src img -append
* img.append(img).append(true) gm convert src img +append
* img.append(img).append(true) gm convert src img +append
* img.append(img).background('#222) gm convert src img -background #222 +append
*
* @param {String} [img]
* @param {Boolean} [ltr]
* @see http://www.graphicsmagick.org/GraphicsMagick.html#details-append
*/
proto.append = function append (img, ltr) {
if (!this._append) {
this._append = [];
this.addSrcFormatter(function (src) {
this.out(this._append.ltr ? '+append' : '-append');
src.push(this._append);
});
}
if (0 === arguments.length) {
this._append.ltr = false;
return this;
}
for (var i = 0; i < arguments.length; ++i) {
var arg = arguments[i];
switch (typeof arg) {
case 'boolean':
this._append.ltr = arg;
break;
case 'string':
this._append.push(arg);
break;
}
}
return this;
}

@@ -36,0 +85,0 @@

@@ -191,3 +191,3 @@ // gm - Copyright Aaron Heckmann <aaron.heckmann+github@gmail.com> (MIT Licensed)

"or getter (size, format, etc...)");
return cb(this, err);
return cb(self, err);
}

@@ -202,3 +202,3 @@

}
cb(this, err);
cb(self, err);
}

@@ -244,7 +244,7 @@

};
cb(this, err, stdout, stderr, cmd);
cb(self, err, stdout, stderr, cmd);
stdout = stderr = onOut = onErr = onExit = null;
});
} else {
cb(this, null, proc.stdout, proc.stderr, cmd);
cb(self, null, proc.stdout, proc.stderr, cmd);
}

@@ -266,6 +266,9 @@

/**
* Returns arguments to be used in the command.
*
* @return {Array}
*/
proto.args = function args () {
var source = (this.sourceStream ? "-" : this.source);
if (source && this.sourceFrames) source += this.sourceFrames;
var outname = this.outname || "-";

@@ -277,3 +280,3 @@ if (this._outputFormat) outname = this._outputFormat + ':' + outname;

, this._in
, source
, this.src()
, this._out

@@ -285,2 +288,35 @@ , outname

/**
* Adds an img source formatter.
*
* `formatters` are passed an array of images which will be
* used as 'input' images for the command. Useful for methods
* like `.append()` where multiple source images may be used.
*
* @param {Function} formatter
* @return {gm} this
*/
proto.addSrcFormatter = function addSrcFormatter (formatter) {
if ('function' != typeof formatter)
throw new TypeError('sourceFormatter must be a function');
this._sourceFormatters || (this._sourceFormatters = []);
this._sourceFormatters.push(formatter);
return this;
}
/**
* Applies all _sourceFormatters
*
* @return {Array}
*/
proto.src = function src () {
var arr = [];
for (var i = 0; i < this._sourceFormatters.length; ++i) {
this._sourceFormatters[i].call(this, arr);
}
return arr;
}
/**
* Image types.

@@ -287,0 +323,0 @@ */

{ "name": "gm"
, "description": "Graphics Magick for node."
, "version": "1.4.2"
, "version": "1.5.0"
, "author": "Aaron Heckmann <aaron.heckmann+github@gmail.com>"
, "keywords": ["nodejs", "graphics magick", "graphics", "magick", "image", "graphicsmagick", "imagemagick"]
, "keywords": ["graphics", "magick", "image", "graphicsmagick", "imagemagick", "gm", "convert", "identify"]
, "engines": { "node": ">= 0.4.2" }

@@ -24,2 +24,3 @@ , "bugs": { "url": "http://github.com/aheckmann/gm/issues" }

}
, "license": "MIT"
, "devDependencies": {

@@ -26,0 +27,0 @@ "gleak": "0.2.4"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc