mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-12-25 04:16:12 -08:00
Compare commits
3 Commits
add-Usage-
...
more-extra
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdb88d798d | ||
|
|
d66fa38804 | ||
|
|
d36b732f55 |
@@ -2,7 +2,7 @@ import os
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from modules import shared, images, devices, scripts, scripts_postprocessing, ui_common, infotext_utils
|
||||
from modules import shared, images, devices, scripts, scripts_postprocessing, ui_common, infotext_utils, util
|
||||
from modules.shared import opts
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ def run_postprocessing(extras_mode, image, image_folder, input_dir, output_dir,
|
||||
for filename in image_list:
|
||||
yield filename, filename
|
||||
else:
|
||||
if isinstance(image, str):
|
||||
image = util.decode_base64_to_image(image)
|
||||
assert image, 'image not selected'
|
||||
yield image, None
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ def create_ui():
|
||||
output_panel.html_log,
|
||||
],
|
||||
show_progress=False,
|
||||
preprocess=False,
|
||||
)
|
||||
|
||||
parameters_copypaste.add_paste_fields("extras", extras_image, None)
|
||||
|
||||
@@ -211,3 +211,13 @@ Requested path was: {path}
|
||||
subprocess.Popen(["wsl-open", path])
|
||||
else:
|
||||
subprocess.Popen(["xdg-open", path])
|
||||
|
||||
|
||||
def decode_base64_to_image(base64_str: str):
|
||||
from modules import images
|
||||
from io import BytesIO
|
||||
import base64
|
||||
if base64_str.startswith("data:image/"):
|
||||
base64_str = base64_str.partition(';')[2].partition(',')[2]
|
||||
image = images.read(BytesIO(base64.b64decode(base64_str)))
|
||||
return image
|
||||
|
||||
Reference in New Issue
Block a user