aboutsummaryrefslogtreecommitdiff
path: root/modules/img2img.py
diff options
context:
space:
mode:
authorMuhammad Rizqi Nur <rizqinur2010@gmail.com>2022-11-02 20:48:58 +0700
committerMuhammad Rizqi Nur <rizqinur2010@gmail.com>2022-11-02 20:48:58 +0700
commit237e79c77deec1924b3547f49402b9c1e51c9535 (patch)
tree589f9aea7ea27791df575371ff322d99ad3f3dbc /modules/img2img.py
parentd5ea878b2aa117588d85287cbd8983aa52177df5 (diff)
parent172c4bc09f0866e7dd114068ebe0f9abfe79ef33 (diff)
Merge branch 'master' into gradient-clipping
Diffstat (limited to 'modules/img2img.py')
-rw-r--r--modules/img2img.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/img2img.py b/modules/img2img.py
index efda26e1..be9f3653 100644
--- a/modules/img2img.py
+++ b/modules/img2img.py
@@ -55,6 +55,7 @@ def process_batch(p, input_dir, output_dir, args):
filename = f"{left}-{n}{right}"
if not save_normally:
+ os.makedirs(output_dir, exist_ok=True)
processed_image.save(os.path.join(output_dir, filename))
@@ -80,7 +81,8 @@ def img2img(mode: int, prompt: str, negative_prompt: str, prompt_style: str, pro
mask = None
# Use the EXIF orientation of photos taken by smartphones.
- image = ImageOps.exif_transpose(image)
+ if image is not None:
+ image = ImageOps.exif_transpose(image)
assert 0. <= denoising_strength <= 1., 'can only work with strength in [0.0, 1.0]'
@@ -136,6 +138,8 @@ def img2img(mode: int, prompt: str, negative_prompt: str, prompt_style: str, pro
if processed is None:
processed = process_images(p)
+ p.close()
+
shared.total_tqdm.clear()
generation_info_js = processed.js()