node.js in-memory image loader
This is our little and very simple image in memory loader! Use it as you like!
Downloading the image http://nodejs.org/images/logos/nodejs-1024x768.png.
var InMemImgLdr = require('./../imgen/InMemoryImageLoader'); InMemImgLdr.load('nodejs.org', '/images/logos/nodejs-1024x768.png', function (buf) { console.log('downloaded the node.js logo wallpaper and it has ' + buf.length / 1024 + ' kilobytes') });LearnBoost / node-canvas https://github.com/LearnBoost/node-canvas
InMemImgLdr.load('nodejs.org', '/images/logos/nodejs-1024x768.png', function (buf) { // ... img = new Image; img.src = buf; t_canvas = new Canvas(img.width, img.height), t_ctx = t_canvas.getContext('2d'); t_ctx.drawImage(img, 0, 0); // ... });