fixes for node.js compatibility-problems

 - replace `document.createElement('img')` with its equivalent `new
   Image()` which works both in node and the browser.
 - added a third-parameter `callback` to the `nodeSave`-function,
   passing the result of `fs.writeFile()`