From dd3856faf718b17662d09c581e0f8d89f2b0ba1f Mon Sep 17 00:00:00 2001 From: liulida <1308919126@qq.com> Date: Sun, 30 Aug 2020 09:43:17 +0800 Subject: [PATCH] make the exported image with high quality,clear --- jquery.wordexport.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.wordexport.js b/jquery.wordexport.js index 6efb1d9..36018ae 100755 --- a/jquery.wordexport.js +++ b/jquery.wordexport.js @@ -31,11 +31,11 @@ if (typeof jQuery !== "undefined" && typeof saveAs !== "undefined") { var h = img[i].height * (w / img[i].width); // Create canvas for converting image to data URL var canvas = document.createElement("CANVAS"); - canvas.width = w; - canvas.height = h; + canvas.width = img[i].width; + canvas.height = img[i].height; // Draw image to canvas var context = canvas.getContext('2d'); - context.drawImage(img[i], 0, 0, w, h); + context.drawImage(img[i], 0, 0, img[i].width, img[i].height); // Get data URL encoding of image var uri = canvas.toDataURL("image/png"); $(img[i]).attr("src", img[i].src);