From 7c526390ed4ad35c93ba1223332057c111c676cd Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 6 Aug 2024 11:44:07 +1000 Subject: [PATCH] fix(ui): compare upscaledPixels vs square of max dimension --- .../web/src/common/hooks/useIsReadyToEnqueue.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/invokeai/frontend/web/src/common/hooks/useIsReadyToEnqueue.ts b/invokeai/frontend/web/src/common/hooks/useIsReadyToEnqueue.ts index 1985e1b57b..7ea5311585 100644 --- a/invokeai/frontend/web/src/common/hooks/useIsReadyToEnqueue.ts +++ b/invokeai/frontend/web/src/common/hooks/useIsReadyToEnqueue.ts @@ -213,9 +213,13 @@ const createSelector = (templates: Templates) => if (!upscale.upscaleInitialImage) { reasons.push({ content: i18n.t('upscaling.missingUpscaleInitialImage') }); } else if (config.maxUpscaleDimension) { - const upscaledPixels = - upscale.upscaleInitialImage.width * upscale.scale * upscale.upscaleInitialImage.height * upscale.scale; - if (upscaledPixels > config.maxUpscaleDimension) { + const { width, height } = upscale.upscaleInitialImage; + const { scale } = upscale; + + const maxPixels = config.maxUpscaleDimension ** 2; + const upscaledPixels = width * scale * height * scale; + + if (upscaledPixels > maxPixels) { reasons.push({ content: i18n.t('upscaling.exceedsMaxSize') }); } }