Imaginate node fixes (#1084)

This commit is contained in:
0HyperCube
2023-03-18 20:34:42 +00:00
committed by Keavon Chambers
parent fe233504ca
commit 9c10d18308
6 changed files with 101 additions and 44 deletions

View File

@@ -149,8 +149,14 @@ impl NodeGraphExecutor {
};
let use_base_image = self.compute_input::<bool>(&network, &imaginate_node, get("Adapt Input Image"), Cow::Borrowed(&image_frame))?;
let base_image = if use_base_image {
let image: Image = self.compute_input(&network, &imaginate_node, get("Input Image"), Cow::Borrowed(&image_frame))?;
let input_image_frame: Option<ImageFrame> = if use_base_image {
Some(self.compute_input::<ImageFrame>(&network, &imaginate_node, get("Input Image"), Cow::Borrowed(&image_frame))?)
} else {
None
};
let image_transform = input_image_frame.as_ref().map(|image_frame| image_frame.transform);
let base_image = if let Some(ImageFrame { image, .. }) = input_image_frame {
// Only use if has size
if image.width > 0 && image.height > 0 {
let (image_data, size) = Self::encode_img(image, Some(resolution), image::ImageOutputFormat::Png)?;
@@ -164,7 +170,7 @@ impl NodeGraphExecutor {
None
};
let mask_image = if base_image.is_some() {
let mask_image = if let Some(transform) = image_transform {
let mask_path: Option<Vec<LayerId>> = self.compute_input(&network, &imaginate_node, get("Masking Layer"), Cow::Borrowed(&image_frame))?;
// Calculate the size of the node graph frame