File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
invokeai/frontend/web/src/features/parameters/hooks Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,16 @@ const createIsTooLargeToUpscaleSelector = (imageDTO?: ImageDTO) =>
11
11
const { maxUpscaleDimension } = config ;
12
12
13
13
if ( ! maxUpscaleDimension || ! upscaleModel || ! imageDTO ) {
14
+ // When these are missing, another warning will be shown
14
15
return false ;
15
16
}
16
17
17
- const upscaledPixels = imageDTO . width * scale * imageDTO . height * scale ;
18
- return upscaledPixels > maxUpscaleDimension * maxUpscaleDimension ;
18
+ const { width, height } = imageDTO ;
19
+
20
+ const maxPixels = maxUpscaleDimension ** 2 ;
21
+ const upscaledPixels = width * scale * height * scale ;
22
+
23
+ return upscaledPixels > maxPixels ;
19
24
} ) ;
20
25
21
26
export const useIsTooLargeToUpscale = ( imageDTO ?: ImageDTO ) => {
You can’t perform that action at this time.
0 commit comments