From 142bd1de5b33c54c33a97a65f89735f037297781 Mon Sep 17 00:00:00 2001 From: wiliam-paradox Date: Fri, 25 May 2018 11:07:08 +0200 Subject: [PATCH] toPng fix In ^2.0.0 method image .toPng is called .toPNG see: https://github.com/electron/electron/blob/master/docs/api/native-image.md#imagetopngoptions --- lib/runner.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/runner.js b/lib/runner.js index 36ab45c9..a38cfec8 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -474,7 +474,16 @@ app.on('ready', function() { // https://gist.github.com/twolfson/0d374d9d7f26eefe7d38 var args = [ function handleCapture(img) { - done(null, img.toPng()) + if(img.toPng) { + done(null, img.toPng()); + + } else if(img.toPNG) { + // @see https://github.com/electron/electron/blob/master/docs/api/native-image.md#imagetopngoptions + done(null, img.toPNG()); + + } else { + done(new Error('no png method found in electrons image.')); + } } ] if (clip) args.unshift(clip)