Their project, node-o3-canvas, is an HTML5 Canvas implementation for NodeJS based on LibAGG and Freetype. It’s implemented using their previously mentioned O3 component system. The goal with node-o3-canvas is not only to create a Canvas-spec type API, but also to extend it to provide easy image resizing, and image processing API’s for server side image processing needs.
Ajax.org makes use of node-o3-canvas as a way to render Canvas charts server-side to allow emailing or save-as-picture.
git clone https://github.com/ajaxorg/node-o3-canvas.git
- open your browser to 127.0.0.1:4000
How to use:
var createContext = require('path/to/node-o3-canvas/lib/o3-canvas');
Here’s a simple example usage:
var ctx = createContext(300,300, "argb"); ctx.clearRect(0,0,300,300); ctx.fillStyle = "rgb(200,0,0)"; ctx.fillRect (10, 10, 55, 50); var buf = ctx.pngBuffer(); console.log(buf.toBase64());
Have comments? Send a tweet to @TheChangelog on Twitter.
Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.