Last active
December 12, 2015 10:47
-
-
Save KennyTw/13f369375b4a016fc6d9 to your computer and use it in GitHub Desktop.
node canvas load image addtext
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var img = new Canvas.Image; // Create a new Image | |
img.src = data; | |
var canvas = new Canvas(img.width, img.height); | |
var ctx = canvas.getContext('2d'); | |
ctx.drawImage(img, 0, 0, img.width, img.height); | |
ctx.font = '22px Helvetica'; | |
ctx.fillText('Hello World', img.width/2, img.height/3); | |
var stream = canvas.createPNGStream();*/ | |
res.writeHead(200, {'Content-Type': 'image/jpeg'}); | |
stream.pipe(res); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment