Skip to content

Commit 7c52639

Browse files
fix(ui): compare upscaledPixels vs square of max dimension
1 parent 2cff20f commit 7c52639

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

invokeai/frontend/web/src/common/hooks/useIsReadyToEnqueue.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,13 @@ const createSelector = (templates: Templates) =>
213213
if (!upscale.upscaleInitialImage) {
214214
reasons.push({ content: i18n.t('upscaling.missingUpscaleInitialImage') });
215215
} else if (config.maxUpscaleDimension) {
216-
const upscaledPixels =
217-
upscale.upscaleInitialImage.width * upscale.scale * upscale.upscaleInitialImage.height * upscale.scale;
218-
if (upscaledPixels > config.maxUpscaleDimension) {
216+
const { width, height } = upscale.upscaleInitialImage;
217+
const { scale } = upscale;
218+
219+
const maxPixels = config.maxUpscaleDimension ** 2;
220+
const upscaledPixels = width * scale * height * scale;
221+
222+
if (upscaledPixels > maxPixels) {
219223
reasons.push({ content: i18n.t('upscaling.exceedsMaxSize') });
220224
}
221225
}

0 commit comments

Comments
 (0)