fixed; use of Buffers with identify()

master
Aaron Heckmann 12 years ago
parent 66cc0e088f
commit 2bdbbd55a3
  1. 7
      index.js
  2. 4
      lib/command.js
  3. 2
      lib/getters.js

@ -35,6 +35,9 @@ function gm (source, height, color) {
if (source instanceof Stream) {
this.sourceStream = source;
source = height || 'unknown.jpg';
} else if (Buffer.isBuffer(source)) {
this.sourceBuffer = source;
source = height || 'unknown.jpg';
} else if (height) {
// new images
width = source;
@ -64,10 +67,12 @@ function gm (source, height, color) {
this.addSrcFormatter(function (src) {
// must be first source formatter
var inputFromStdin = this.sourceStream || Buffer.isBuffer(this.source);
var inputFromStdin = this.sourceStream || this.sourceBuffer;
var ret = inputFromStdin ? '-' : this.source;
if (ret && this.sourceFrames) ret += this.sourceFrames;
src.length = 0;
src[0] = ret;
});

@ -183,8 +183,8 @@ module.exports = function (proto) {
debug(cmd);
if (Buffer.isBuffer(this.source)) {
proc.stdin.write(this.source);
if (this.sourceBuffer) {
proc.stdin.write(this.sourceBuffer);
proc.stdin.end();
} else if (self.sourceStream) {

@ -232,7 +232,7 @@ module.exports = function (gm) {
args.push('-verbose');
}
args.push(self.sourceStream ? '-' : self.source);
args.push(self.sourceStream || self.sourceBuffer ? '-' : self.source);
return args;
}

Loading…
Cancel
Save