diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-04-29 15:21:28 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-29 15:21:28 +0000 |
commit | b615a2ed11b4d8f9345ae89c3e65c3fe5b24b244 (patch) | |
tree | d7cf112e8c6f0df2fb4646d8953e80fcb0812d4f /modules/img2img.py | |
parent | 103fc062a5edb8e5a8e79099cc3f80c75c4158af (diff) | |
parent | eabecc21ecd240b63cd4b3996286b74e794ddcea (diff) | |
download | stable-diffusion-webui-gfx803-b615a2ed11b4d8f9345ae89c3e65c3fe5b24b244.tar.gz stable-diffusion-webui-gfx803-b615a2ed11b4d8f9345ae89c3e65c3fe5b24b244.tar.bz2 stable-diffusion-webui-gfx803-b615a2ed11b4d8f9345ae89c3e65c3fe5b24b244.zip |
Merge pull request #9108 from AUTOMATIC1111/img2img-scale-by
add "resize by" and "resize to" tabs to img2img
Diffstat (limited to 'modules/img2img.py')
-rw-r--r-- | modules/img2img.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/img2img.py b/modules/img2img.py index 603912ea..56c846d6 100644 --- a/modules/img2img.py +++ b/modules/img2img.py @@ -81,7 +81,7 @@ def process_batch(p, input_dir, output_dir, inpaint_mask_dir, args): processed_image.save(os.path.join(output_dir, filename))
-def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_styles, init_img, sketch, init_img_with_mask, inpaint_color_sketch, inpaint_color_sketch_orig, init_img_inpaint, init_mask_inpaint, steps: int, sampler_index: int, mask_blur: int, mask_alpha: float, inpainting_fill: int, restore_faces: bool, tiling: bool, n_iter: int, batch_size: int, cfg_scale: float, image_cfg_scale: float, denoising_strength: float, seed: int, subseed: int, subseed_strength: float, seed_resize_from_h: int, seed_resize_from_w: int, seed_enable_extras: bool, height: int, width: int, resize_mode: int, inpaint_full_res: bool, inpaint_full_res_padding: int, inpainting_mask_invert: int, img2img_batch_input_dir: str, img2img_batch_output_dir: str, img2img_batch_inpaint_mask_dir: str, override_settings_texts, *args):
+def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_styles, init_img, sketch, init_img_with_mask, inpaint_color_sketch, inpaint_color_sketch_orig, init_img_inpaint, init_mask_inpaint, steps: int, sampler_index: int, mask_blur: int, mask_alpha: float, inpainting_fill: int, restore_faces: bool, tiling: bool, n_iter: int, batch_size: int, cfg_scale: float, image_cfg_scale: float, denoising_strength: float, seed: int, subseed: int, subseed_strength: float, seed_resize_from_h: int, seed_resize_from_w: int, seed_enable_extras: bool, selected_scale_tab: int, height: int, width: int, scale_by: float, resize_mode: int, inpaint_full_res: bool, inpaint_full_res_padding: int, inpainting_mask_invert: int, img2img_batch_input_dir: str, img2img_batch_output_dir: str, img2img_batch_inpaint_mask_dir: str, override_settings_texts, *args):
override_settings = create_override_settings_dict(override_settings_texts)
is_batch = mode == 5
@@ -117,6 +117,12 @@ def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_s if image is not None:
image = ImageOps.exif_transpose(image)
+ if selected_scale_tab == 1:
+ assert image, "Can't scale by because no image is selected"
+
+ width = int(image.width * scale_by)
+ height = int(image.height * scale_by)
+
assert 0. <= denoising_strength <= 1., 'can only work with strength in [0.0, 1.0]'
p = StableDiffusionProcessingImg2Img(
|