mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat: Add output image resizing for DWPose
This commit is contained in:
committed by
Kent Keirsey
parent
f7998b4be0
commit
67cbfeb33d
@ -1,4 +1,4 @@
|
||||
import { Flex, FormControl, FormLabel, Switch } from '@invoke-ai/ui-library';
|
||||
import { CompositeNumberInput, CompositeSlider, Flex, FormControl, FormLabel, Switch } from '@invoke-ai/ui-library';
|
||||
import { useProcessorNodeChanged } from 'features/controlAdapters/components/hooks/useProcessorNodeChanged';
|
||||
import { CONTROLNET_PROCESSORS } from 'features/controlAdapters/store/constants';
|
||||
import type { RequiredDWPoseImageProcessorInvocation } from 'features/controlAdapters/store/types';
|
||||
@ -18,7 +18,7 @@ type Props = {
|
||||
|
||||
const DWPoseProcessor = (props: Props) => {
|
||||
const { controlNetId, processorNode, isEnabled } = props;
|
||||
const { draw_body, draw_face, draw_hands } = processorNode;
|
||||
const { image_resolution, draw_body, draw_face, draw_hands } = processorNode;
|
||||
const processorChanged = useProcessorNodeChanged();
|
||||
const { t } = useTranslation();
|
||||
|
||||
@ -43,6 +43,13 @@ const DWPoseProcessor = (props: Props) => {
|
||||
[controlNetId, processorChanged]
|
||||
);
|
||||
|
||||
const handleImageResolutionChanged = useCallback(
|
||||
(v: number) => {
|
||||
processorChanged(controlNetId, { image_resolution: v });
|
||||
},
|
||||
[controlNetId, processorChanged]
|
||||
);
|
||||
|
||||
return (
|
||||
<ProcessorWrapper>
|
||||
<Flex sx={{ flexDir: 'row', gap: 6 }}>
|
||||
@ -59,6 +66,24 @@ const DWPoseProcessor = (props: Props) => {
|
||||
<Switch defaultChecked={DEFAULTS.draw_hands} isChecked={draw_hands} onChange={handleDrawHandsChanged} />
|
||||
</FormControl>
|
||||
</Flex>
|
||||
<FormControl isDisabled={!isEnabled}>
|
||||
<FormLabel>{t('controlnet.imageResolution')}</FormLabel>
|
||||
<CompositeSlider
|
||||
value={image_resolution}
|
||||
onChange={handleImageResolutionChanged}
|
||||
defaultValue={DEFAULTS.image_resolution}
|
||||
min={0}
|
||||
max={4096}
|
||||
marks
|
||||
/>
|
||||
<CompositeNumberInput
|
||||
value={image_resolution}
|
||||
onChange={handleImageResolutionChanged}
|
||||
defaultValue={DEFAULTS.image_resolution}
|
||||
min={0}
|
||||
max={4096}
|
||||
/>
|
||||
</FormControl>
|
||||
</ProcessorWrapper>
|
||||
);
|
||||
};
|
||||
|
@ -232,6 +232,7 @@ export const CONTROLNET_PROCESSORS: ControlNetProcessorsDict = {
|
||||
default: {
|
||||
id: 'dwpose_image_processor',
|
||||
type: 'dwpose_image_processor',
|
||||
image_resolution: 512,
|
||||
draw_body: true,
|
||||
draw_face: false,
|
||||
draw_hands: false,
|
||||
|
@ -157,7 +157,7 @@ export type RequiredOpenposeImageProcessorInvocation = O.Required<
|
||||
*/
|
||||
export type RequiredDWPoseImageProcessorInvocation = O.Required<
|
||||
DWPoseImageProcessorInvocation,
|
||||
'type' | 'draw_body' | 'draw_face' | 'draw_hands'
|
||||
'type' | 'image_resolution' | 'draw_body' | 'draw_face' | 'draw_hands'
|
||||
>;
|
||||
|
||||
/**
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user