I have a PhantomJS application where I would like to take a series of screenshots from a JS-managed page (via page.renderBase64('PNG')), and then stitch these screenshots into GIFs.
As far as I can tell, there is no way in Node to build GIFs from blank base64 strings, and I would prefer not to write every frame to disk and then go beyond Node to stitch them together with ImageMagick or the like - this will significantly slow down the process. So my plan was to draw base64 images on the canvas and then add the canvas to the GIF Node generator.
Although I can use node-canvas in a Node environment without problems when I include a require('canvas')script in my Phantom, it fails when I launch a new Canvas object, spitting out the usual errors that are visible in the absence of dependencies:
Error: Cannot find module './lib/node-canvas/build/Release/canvas'
phantomjs://platform/bootstrap.js:299 in require
phantomjs://platform/bootstrap.js:263 in require
Part of the problem, I think, is that Phantom is running Node from a different environment where there aren't all the dependencies. But I don't quite understand how Node and PhantomJS are different in Javascript execution. I do not understand what it is phantomjs://platform/bootstrap.js, or I can expand it.
To be clear, I use the Phantom - Node bridge, where I start the script with var page = require('webpage').create();. Then I run the script using phantomjsfrom the command line.
TL; DR: Node ++, node -canvas, PhantomJS script , Node, ? Node , ?
: , <canvas> , Phantom, , , - JS script.