diff --git a/test/image.test.js b/test/image.test.js
index <HASH>..<HASH> 100644
--- a/test/image.test.js
+++ b/test/image.test.js
@@ -30,6 +30,15 @@ describe('mapnik.Image ', function() {
         assert.throws(function() { im.save('foo','foo'); });
     });
 
+    it('should throw with invalid binary read from buffer', function() {
+        assert.throws(function() { new mapnik.Image.fromBytes(new Buffer(0)); });
+        assert.throws(function() { new mapnik.Image.fromBytes(new Buffer(1024)); });
+        var buffer = new Buffer('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A' + Array(48).join('\0'), 'binary');
+        assert.throws(function() { new mapnik.Image.fromBytes(buffer); });
+        buffer = new Buffer('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A', 'binary');
+        assert.throws(function() { new mapnik.Image.fromBytes(buffer); });
+    });
+
     it('should throw with invalid encoding format 3', function(done) {
         var im = new mapnik.Image(256, 256);
         im.encode('foo',function(err) {
ensure reading invalid images from buffers properly throw