diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2024-01-01 14:01:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-01 14:01:06 +0000 |
commit | 7ba02e0b7cfc85d5d237eba71ab4d66564857d55 (patch) | |
tree | b317227a0e63c42aa8c4b06147761dfd37ae24fc /scripts/postprocessing_create_flipped_copies.py | |
parent | be31e7e71a08dc27543d31aa6e6532463ccbf20f (diff) | |
parent | 15156cde18844f459ba101b1356d162aa7f39c47 (diff) | |
download | stable-diffusion-webui-gfx803-7ba02e0b7cfc85d5d237eba71ab4d66564857d55.tar.gz stable-diffusion-webui-gfx803-7ba02e0b7cfc85d5d237eba71ab4d66564857d55.tar.bz2 stable-diffusion-webui-gfx803-7ba02e0b7cfc85d5d237eba71ab4d66564857d55.zip |
Merge branch 'dev' into finer-settings-freezing-control
Diffstat (limited to 'scripts/postprocessing_create_flipped_copies.py')
-rw-r--r-- | scripts/postprocessing_create_flipped_copies.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/postprocessing_create_flipped_copies.py b/scripts/postprocessing_create_flipped_copies.py new file mode 100644 index 00000000..b673003b --- /dev/null +++ b/scripts/postprocessing_create_flipped_copies.py @@ -0,0 +1,32 @@ +from PIL import ImageOps, Image
+
+from modules import scripts_postprocessing, ui_components
+import gradio as gr
+
+
+class ScriptPostprocessingCreateFlippedCopies(scripts_postprocessing.ScriptPostprocessing):
+ name = "Create flipped copies"
+ order = 4030
+
+ def ui(self):
+ with ui_components.InputAccordion(False, label="Create flipped copies") as enable:
+ with gr.Row():
+ option = gr.CheckboxGroup(value=["Horizontal"], choices=["Horizontal", "Vertical", "Both"], show_label=False)
+
+ return {
+ "enable": enable,
+ "option": option,
+ }
+
+ def process(self, pp: scripts_postprocessing.PostprocessedImage, enable, option):
+ if not enable:
+ return
+
+ if "Horizontal" in option:
+ pp.extra_images.append(ImageOps.mirror(pp.image))
+
+ if "Vertical" in option:
+ pp.extra_images.append(pp.image.transpose(Image.Transpose.FLIP_TOP_BOTTOM))
+
+ if "Both" in option:
+ pp.extra_images.append(pp.image.transpose(Image.Transpose.FLIP_TOP_BOTTOM).transpose(Image.Transpose.FLIP_LEFT_RIGHT))
|