From d4b794561ce61c079f72a9630a41d99d72381f05 Mon Sep 17 00:00:00 2001 From: Zach Bjornson Date: Mon, 29 Feb 2016 21:06:39 -0800 Subject: [PATCH] Properly clamp quality in toDataURL --- lib/canvas.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/canvas.js b/lib/canvas.js index 139c579..03d2d52 100644 --- a/lib/canvas.js +++ b/lib/canvas.js @@ -232,7 +232,7 @@ Canvas.prototype.toDataURL = function(a1, a2, a3){ if ('object' === typeof a2) { opts = a2; } else if ('number' === typeof a2) { - opts = {quality: Math.min(0, Math.max(1, a2)) * 100}; + opts = {quality: Math.max(0, Math.min(1, a2)) * 100}; } if ('function' === typeof a3) {