diff --git a/imagemagick.js b/imagemagick.js index b846c0c..09373ed 100644 --- a/imagemagick.js +++ b/imagemagick.js @@ -153,12 +153,19 @@ exports.identify = function(pathOrArgs, callback) { result = stdout; } else { result = parseIdentify(stdout); - geometry = result['geometry'].split(/x/); - result.format = result.format.match(/\S*/)[0] - result.width = parseInt(geometry[0]); - result.height = parseInt(geometry[1]); - result.depth = parseInt(result.depth); + if (result.format) { + result.format = result.format.match(/\S*/)[0]; + } + + if (result['geometry']) { + geometry = result['geometry'].split(/x/); + result.width = parseInt(geometry[0]); + result.height = parseInt(geometry[1]); + } + if (result.depth) { + result.depth = parseInt(result.depth); + } if (result.quality !== undefined) result.quality = parseInt(result.quality) / 100; } }