Skip to content

Commit b10d745

Browse files
psychedelicioushipsterusername
authored andcommitted
fix(ui): when using control image dimensions, round to 8
The control image dimensions were set directly without rounding them to 8, causing an error during generation if they weren't a multiple of 8.
1 parent c9c150f commit b10d745

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

invokeai/frontend/web/src/features/controlAdapters/components/ControlAdapterImagePreview.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
55
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
66
import IAIDndImage from 'common/components/IAIDndImage';
77
import IAIDndImageIcon from 'common/components/IAIDndImageIcon';
8+
import { roundToMultiple } from 'common/util/roundDownToMultiple';
89
import { setBoundingBoxDimensions } from 'features/canvas/store/canvasSlice';
910
import { useControlAdapterControlImage } from 'features/controlAdapters/hooks/useControlAdapterControlImage';
1011
import { useControlAdapterProcessedControlImage } from 'features/controlAdapters/hooks/useControlAdapterProcessedControlImage';
@@ -91,19 +92,14 @@ const ControlAdapterImagePreview = ({ isSmall, id }: Props) => {
9192
return;
9293
}
9394

95+
const width = roundToMultiple(controlImage.width, 8);
96+
const height = roundToMultiple(controlImage.height, 8);
97+
9498
if (activeTabName === 'unifiedCanvas') {
95-
dispatch(
96-
setBoundingBoxDimensions(
97-
{
98-
width: controlImage.width,
99-
height: controlImage.height,
100-
},
101-
optimalDimension
102-
)
103-
);
99+
dispatch(setBoundingBoxDimensions({ width, height }, optimalDimension));
104100
} else {
105-
dispatch(widthChanged(controlImage.width));
106-
dispatch(heightChanged(controlImage.height));
101+
dispatch(widthChanged(width));
102+
dispatch(heightChanged(height));
107103
}
108104
}, [controlImage, activeTabName, dispatch, optimalDimension]);
109105

0 commit comments

Comments
 (0)