From 86f4fbd27b5fdaf85f10dea8d244b8bc8a859260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= Date: Sat, 11 Jan 2025 20:15:40 +0100 Subject: [PATCH] Fail-safe when naturalWidth is actually in width --- lib/imageUtils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/imageUtils.js b/lib/imageUtils.js index f7d10e4..8b5bf6d 100644 --- a/lib/imageUtils.js +++ b/lib/imageUtils.js @@ -83,8 +83,8 @@ class CanvasUtil { ? createCanvas(sw || image.width, sh || image.height) : document.createElement("canvas"); - canvas.width = image.naturalWidth || sw; - canvas.height = image.naturalHeight || sh; + canvas.width = image.naturalWidth || sw || image.width; + canvas.height = image.naturalHeight || sh || image.height; const ctx = canvas.getContext("2d");