diff --git a/invokeai/frontend/web/src/services/api/endpoints/images.ts b/invokeai/frontend/web/src/services/api/endpoints/images.ts index 8860ebf3f1..9e74982a79 100644 --- a/invokeai/frontend/web/src/services/api/endpoints/images.ts +++ b/invokeai/frontend/web/src/services/api/endpoints/images.ts @@ -270,12 +270,15 @@ export const imagesApi = api.injectEndpoints({ }, }), uploadImage: build.mutation({ - query: ({ file, image_category, is_intermediate, session_id, board_id, crop_visible, metadata }) => { + query: ({ file, image_category, is_intermediate, session_id, board_id, crop_visible, metadata, resize_to }) => { const formData = new FormData(); formData.append('file', file); if (metadata) { formData.append('metadata', JSON.stringify(metadata)); } + if (resize_to) { + formData.append('resize_to', JSON.stringify(resize_to)); + } return { url: buildImagesUrl('upload'), method: 'POST', diff --git a/invokeai/frontend/web/src/services/api/types.ts b/invokeai/frontend/web/src/services/api/types.ts index 64aa0051de..b0f7d00088 100644 --- a/invokeai/frontend/web/src/services/api/types.ts +++ b/invokeai/frontend/web/src/services/api/types.ts @@ -1,3 +1,4 @@ +import type { Dimensions } from 'features/controlLayers/store/types'; import type { components, paths } from 'services/api/schema'; import type { JsonObject, SetRequired } from 'type-fest'; @@ -373,6 +374,10 @@ export type UploadImageArg = { * Whether this is the first upload of a batch (used when displaying user feedback with toasts - ignored if the upload is silent) */ isFirstUploadOfBatch?: boolean; + /** + * If provided, the uploaded image will resized to the given dimensions. + */ + resize_to?: Dimensions; }; export type ImageUploadEntryResponse = S['ImageUploadEntry'];