diff --git a/lib/getters.js b/lib/getters.js index 42e07bb..bd68abc 100755 --- a/lib/getters.js +++ b/lib/getters.js @@ -280,9 +280,16 @@ module.exports = function (gm) { // We only want the size of the first frame. // Each frame is separated by a space. var split = val.split(" ").shift().split("x"); - o.size = { - width: parseInt(split[0], 10) - , height: parseInt(split[1], 10) + var width = parseInt(split[0], 10); + var height = parseInt(split[1], 10); + if (o.size && o.size.width && o.size.height) { + if (width > o.size.width) o.size.width = width; + if (height > o.size.height) o.size.height = height; + } else { + o.size = { + width: width, + height: height + } } }; diff --git a/test/393.js b/test/393.js new file mode 100644 index 0000000..b339b0a --- /dev/null +++ b/test/393.js @@ -0,0 +1,20 @@ +'use strict'; + +var assert = require('assert'); +var fs = require('fs'); +var path = require('path'); + +module.exports = function (_, dir, finish, gm) { + if (!gm.integration) return finish(); + + var imagePath = path.join(__dirname, './fixtures/nyancat.gif'); + var inputStream = fs.createReadStream(imagePath); + gm(inputStream) + .identify({ bufferStream: true }, function(err, value) { + if (err) return finish(err); + var size = value.size; + assert.equal(400, size.width); + assert.equal(400, size.height); + finish(); + }); +} diff --git a/test/fixtures/nyancat.gif b/test/fixtures/nyancat.gif new file mode 100644 index 0000000..fd2c77f Binary files /dev/null and b/test/fixtures/nyancat.gif differ