From b1d8500611ce0446f702bf496146cf7a1bd611c9 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 15 Dec 2024 23:13:08 +0100 Subject: [PATCH] use the original dims for the color extractor --- static/js/markdown.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/markdown.js b/static/js/markdown.js index 345e612..64fea6c 100644 --- a/static/js/markdown.js +++ b/static/js/markdown.js @@ -30,10 +30,12 @@ const svgChangeTheme = (mode) => { */ const extractColors = (image) => { const canvas = document.createElement("canvas"); - canvas.width = image.width; - canvas.height = image.height; + canvas.width = image.naturalWidth; + canvas.height = image.naturalHeight; const ctx = canvas.getContext("2d"); ctx.drawImage(image, 0, 0); + console.log(image); + const imageData = ctx.getImageData( 0, 0,