From fd5e7bfc80ab93a472f9f7c9e26adf036ff4d1f8 Mon Sep 17 00:00:00 2001 From: jamz-uk <222520099+jamz-uk@users.noreply.github.com> Date: Thu, 21 Aug 2025 22:45:19 +0100 Subject: [PATCH] fix --- Auto-Image.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Auto-Image.js b/Auto-Image.js index e882e23..5a35b12 100644 --- a/Auto-Image.js +++ b/Auto-Image.js @@ -4823,13 +4823,18 @@ updateDataButtons() function showResizeDialog(processor) { - // Always base resizing off the original image if we have it let baseProcessor = processor; + let width, height; if (state.originalImage?.dataUrl) { baseProcessor = new ImageProcessor(state.originalImage.dataUrl); + width = state.originalImage.width; + height = state.originalImage.height; + } else { + const dims = processor.getDimensions(); + width = dims.width; + height = dims.height; } - const { width, height } = baseProcessor.getDimensions ? baseProcessor.getDimensions() : processor.getDimensions(); - const aspectRatio = width / height; + const aspectRatio = width / height; const rs = state.resizeSettings; const initialW = rs && rs.baseWidth === width && rs.baseHeight === height ? (rs.width || width) : width; @@ -4857,7 +4862,7 @@ tempCanvas.width = newWidth; tempCanvas.height = newHeight; tempCtx.imageSmoothingEnabled = false; - if (baseProcessor !== processor && !baseProcessor.img) { + if (baseProcessor !== processor && (!baseProcessor.img || !baseProcessor.canvas)) { // load on demand if instantiated from stored dataUrl await baseProcessor.load(); } @@ -4978,7 +4983,7 @@ tempCanvas.width = newWidth; tempCanvas.height = newHeight; tempCtx.imageSmoothingEnabled = false; - if (baseProcessor !== processor && !baseProcessor.img) { + if (baseProcessor !== processor && (!baseProcessor.img || !baseProcessor.canvas)) { await baseProcessor.load(); } tempCtx.drawImage(baseProcessor.img, 0, 0, newWidth, newHeight);