Compare commits

...

3 Commits

Author SHA1 Message Date
w-e-w
cdb88d798d disable img preprocess for extra submit
base64 img
2024-05-01 01:07:22 +09:00
w-e-w
d66fa38804 run_postprocessing: allow base64 image as input 2024-05-01 01:05:33 +09:00
w-e-w
d36b732f55 util decode_base64_to_image 2024-05-01 01:04:20 +09:00
3 changed files with 14 additions and 1 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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