|
|
@ -185,8 +185,11 @@ Canvas.prototype.createJPEGStream = function(options){ |
|
|
|
Canvas.prototype.syncJPEGStream = |
|
|
|
Canvas.prototype.createSyncJPEGStream = function(options){ |
|
|
|
options = options || {}; |
|
|
|
// Don't allow the buffer size to exceed the size of the canvas (#674)
|
|
|
|
var maxBufSize = this.width * this.height * 4; |
|
|
|
var clampedBufSize = Math.min(options.bufsize || 4096, maxBufSize); |
|
|
|
return new JPEGStream(this, { |
|
|
|
bufsize: options.bufsize || 4096 |
|
|
|
bufsize: clampedBufSize |
|
|
|
, quality: options.quality || 75 |
|
|
|
, progressive: options.progressive || false |
|
|
|
}); |
|
|
|