diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2022-12-24 08:10:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-24 08:10:35 +0000 |
commit | b2dbd4d698ace33a5821b93fb978cac724d1667e (patch) | |
tree | 2094bf1de8d51fe4c321e0923c02ca6a7ddd543c /modules/processing.py | |
parent | 34bc3616ecea2799ca4aec460ef11c4f726bb9a4 (diff) | |
parent | 358a8628f6abb4ca1e1bfddf122687c6fb13be0c (diff) | |
download | stable-diffusion-webui-gfx803-b2dbd4d698ace33a5821b93fb978cac724d1667e.tar.gz stable-diffusion-webui-gfx803-b2dbd4d698ace33a5821b93fb978cac724d1667e.tar.bz2 stable-diffusion-webui-gfx803-b2dbd4d698ace33a5821b93fb978cac724d1667e.zip |
Merge pull request #5521 from AndrewRyanChama/ryan/img2imglatentscale
Add latent upscale option to img2img
Diffstat (limited to 'modules/processing.py')
-rw-r--r-- | modules/processing.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/processing.py b/modules/processing.py index 6aa4f2cc..75b0067c 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -837,7 +837,7 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing): for img in self.init_images:
image = images.flatten(img, opts.img2img_background_color)
- if crop_region is None:
+ if crop_region is None and self.resize_mode != 3:
image = images.resize_image(self.resize_mode, image, self.width, self.height)
if image_mask is not None:
@@ -846,6 +846,7 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing): self.overlay_images.append(image_masked.convert('RGBA'))
+ # crop_region is not none iif we are doing inpaint full res
if crop_region is not None:
image = image.crop(crop_region)
image = images.resize_image(2, image, self.width, self.height)
@@ -882,6 +883,9 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing): self.init_latent = self.sd_model.get_first_stage_encoding(self.sd_model.encode_first_stage(image))
+ if self.resize_mode == 3:
+ self.init_latent = torch.nn.functional.interpolate(self.init_latent, size=(self.height // opt_f, self.width // opt_f), mode="bilinear")
+
if image_mask is not None:
init_mask = latent_mask
latmask = init_mask.convert('RGB').resize((self.init_latent.shape[3], self.init_latent.shape[2]))
|