Skip to content

Commit

Permalink
feat: add ad_save_images_dir (#689)
Browse files Browse the repository at this point in the history
* feat: add `ad-save-images`

#688

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* feat: only enable `ad_save_images_dir` when not empty

#689 (comment)

* fix: F401 `pathlib.PurePath` imported but unused

https://results.pre-commit.ci/run/github/632823919/1724229072.nxpHBQU4QvaIJ8IOFayT1Q

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
bluelovers and pre-commit-ci[bot] authored Aug 24, 2024
1 parent 38db25b commit cc0a113
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/!adetailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,14 @@ def save_image(self, p, image, *, condition: str, suffix: str) -> None:
seed, _ = self.get_seed(p)

if opts.data.get(condition, False):
ad_save_images_dir = opts.data.get("ad_save_images_dir", None)

if not bool(ad_save_images_dir and ad_save_images_dir.strip()):
ad_save_images_dir = p.outpath_samples

images.save_image(
image=image,
path=p.outpath_samples,
path=ad_save_images_dir,
basename="",
seed=seed,
prompt=save_prompt,
Expand Down Expand Up @@ -973,6 +978,16 @@ def on_ui_settings():
.needs_reload_ui(),
)

shared.opts.add_option(
"ad_save_images_dir",
shared.OptionInfo(
default="",
label="Output directory for adetailer images",
component=gr.Textbox,
section=section,
),
)

shared.opts.add_option(
"ad_save_previews",
shared.OptionInfo(False, "Save mask previews", section=section),
Expand Down

0 comments on commit cc0a113

Please sign in to comment.