mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): img2img
This commit is contained in:
parent
865b6017d3
commit
1216c6f9c9
@ -1,7 +1,7 @@
|
||||
import type { CanvasManager } from 'features/controlLayers/konva/CanvasManager';
|
||||
import type { CanvasV2State, Dimensions } from 'features/controlLayers/store/types';
|
||||
import type { Graph } from 'features/nodes/util/graph/generation/Graph';
|
||||
import { isEqual, pick } from 'lodash-es';
|
||||
import { isEqual } from 'lodash-es';
|
||||
import type { Invocation } from 'services/api/types';
|
||||
|
||||
export const addImageToImage = async (
|
||||
@ -17,15 +17,14 @@ export const addImageToImage = async (
|
||||
): Promise<Invocation<'img_resize' | 'l2i'>> => {
|
||||
denoise.denoising_start = denoising_start;
|
||||
|
||||
const cropBbox = pick(bbox.rect, ['x', 'y', 'width', 'height']);
|
||||
const initialImage = await manager.getInitialImage({ bbox: cropBbox });
|
||||
const { image_name } = await manager.getCompositeLayerImageDTO(bbox.rect);
|
||||
|
||||
if (!isEqual(scaledSize, originalSize)) {
|
||||
// Resize the initial image to the scaled size, denoise, then resize back to the original size
|
||||
const resizeImageToScaledSize = g.addNode({
|
||||
id: 'initial_image_resize_in',
|
||||
type: 'img_resize',
|
||||
image: { image_name: initialImage.image_name },
|
||||
image: { image_name },
|
||||
...scaledSize,
|
||||
});
|
||||
const i2l = g.addNode({ id: 'i2l', type: 'i2l' });
|
||||
@ -44,7 +43,7 @@ export const addImageToImage = async (
|
||||
return resizeImageToOriginalSize;
|
||||
} else {
|
||||
// No need to resize, just denoise
|
||||
const i2l = g.addNode({ id: 'i2l', type: 'i2l', image: { image_name: initialImage.image_name } });
|
||||
const i2l = g.addNode({ id: 'i2l', type: 'i2l', image: { image_name } });
|
||||
g.addEdge(vaeSource, 'vae', i2l, 'vae');
|
||||
g.addEdge(i2l, 'latents', denoise, 'latents');
|
||||
return l2i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user