mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(ui): support embedding metadata when rasterizing composite layer
- Allow `uploadImage` util to accept `metadata` to embed in the image - Update compositor to support `metadata` field when uploading rasterized composite layer
This commit is contained in:
@@ -587,20 +587,29 @@ export const getImageDTO = async (image_name: string, forceRefetch?: boolean): P
|
||||
}
|
||||
};
|
||||
|
||||
export const uploadImage = async (arg: {
|
||||
export type UploadOptions = {
|
||||
blob: Blob;
|
||||
fileName: string;
|
||||
image_category: ImageCategory;
|
||||
is_intermediate: boolean;
|
||||
crop_visible?: boolean;
|
||||
board_id?: BoardId;
|
||||
}): Promise<ImageDTO> => {
|
||||
const { blob, fileName, image_category, is_intermediate, crop_visible = false, board_id } = arg;
|
||||
metadata?: SerializableObject;
|
||||
};
|
||||
export const uploadImage = async (arg: UploadOptions): Promise<ImageDTO> => {
|
||||
const { blob, fileName, image_category, is_intermediate, crop_visible = false, board_id, metadata } = arg;
|
||||
|
||||
const { dispatch } = getStore();
|
||||
const file = new File([blob], fileName, { type: 'image/png' });
|
||||
const req = dispatch(
|
||||
imagesApi.endpoints.uploadImage.initiate({ file, image_category, is_intermediate, crop_visible, board_id })
|
||||
imagesApi.endpoints.uploadImage.initiate({
|
||||
file,
|
||||
image_category,
|
||||
is_intermediate,
|
||||
crop_visible,
|
||||
board_id,
|
||||
metadata,
|
||||
})
|
||||
);
|
||||
req.reset();
|
||||
return await req.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user