From 958f37d8fb63cceee7405f353ee2a94fcf217635 Mon Sep 17 00:00:00 2001 From: Cedric Wienold Date: Thu, 17 Jan 2013 12:48:41 -0800 Subject: [PATCH] Add createJPEGStream support for fabric canvas Node Canvas already has support for createJPEGStream. Create a route to take advantage of that through fabric.js canvas. --- src/node.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/node.js b/src/node.js index 9b94e0fd..0cfaa7c9 100644 --- a/src/node.js +++ b/src/node.js @@ -121,6 +121,10 @@ return this.nodeCanvas.createPNGStream(); }; + fabric.StaticCanvas.prototype.createJPEGStream = function(opts) { + return this.nodeCanvas.createJPEGStream(opts); + }; + var origSetWidth = fabric.StaticCanvas.prototype.setWidth; fabric.StaticCanvas.prototype.setWidth = function(width) { origSetWidth.call(this); @@ -141,4 +145,4 @@ fabric.Canvas.prototype.setHeight = fabric.StaticCanvas.prototype.setHeight; } -})(); \ No newline at end of file +})();