Skip to content

Commit

Permalink
added; proto.selectFrame(#). closes aheckmann#202
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanong committed Aug 18, 2013
1 parent fd8c16d commit 89f9511
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ var argsToArray = require('./utils').argsToArray;
*/

module.exports = function (proto) {
// change the specified frame.
// See #202.
proto.selectFrame = function (frame) {
if (typeof frame === 'number')
this.sourceFrames = '[' + frame + ']';
return this;
}

// define the sub-command to use, http://www.graphicsmagick.org/utilities.html
proto.command = proto.subCommand = function subCommand (name){
Expand Down
20 changes: 20 additions & 0 deletions test/selectFrame.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var assert = require('assert');
var fs = require('fs')

module.exports = function (_, dir, finish, gm) {
var m = gm(dir + '/original.gif[0]')

if (!gm.integration)
return finish();

m.identify('%#', function (err, hash1) {
if (err) return finish(err);

m.selectFrame(2).identify('%#', function (err, hash2) {
if (err) return finish(err);

assert.ok(hash1.toString().trim() !== hash2.toString().trim())
finish();
})
})
}

0 comments on commit 89f9511

Please sign in to comment.