forked from aheckmann/gm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request aheckmann#144 from jonathanong/buffer-stream-auto-…
…orient add bufferStream option again, add streaming autoOrient test
- Loading branch information
Showing
6 changed files
with
76 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
language: node_js | ||
node_js: | ||
- "0.4" | ||
- "0.6" | ||
- "0.8" | ||
- "0.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
// gm - Copyright Aaron Heckmann <[email protected]> (MIT Licensed) | ||
// This is a copy of `autoOrient.js` using streams | ||
|
||
var assert = require('assert') | ||
var fs = require('fs') | ||
|
||
module.exports = function (_, dir, finish, gm) { | ||
if (!gm.integration) | ||
return finish(); | ||
|
||
var filename = dir + '/autoOrient.jpg'; | ||
|
||
gm(fs.createReadStream(dir + '/originalSideways.jpg')).orientation(function (err, o) { | ||
if (err) return finish(err); | ||
|
||
assert.equal('RightTop', o); | ||
assert.ok(!! this.data['Profile-EXIF'], 'No Profile-EXIF data found'); | ||
assert.equal('155x460', this.data.Geometry); | ||
|
||
// this image is sideways, but may be auto-oriented by modern OS's | ||
// try opening it in a browser to see its true orientation | ||
gm(fs.createReadStream(dir + '/originalSideways.jpg')) | ||
.autoOrient() | ||
.write(filename, function autoOrient (err) { | ||
if (err) return finish(err); | ||
|
||
// fs race condition | ||
setTimeout(function () { | ||
gm(filename).identify(function (err) { | ||
if (err) return finish(err); | ||
|
||
assert.equal('Unknown', this.data.Orientation); | ||
assert.ok(! this.data['Profile-EXIF'], 'Profile-EXIF still exists'); | ||
assert.equal('460x155', this.data.Geometry); | ||
|
||
finish(err); | ||
}); | ||
}, 200); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters