Compare commits

..

14 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
w-e-w 9d39380705 fix extra batch mode P Transparency
red, green, blue = transparency TypeError: cannot unpack non-iterable int object
2024-04-30 19:17:53 +09:00
AUTOMATIC1111 ddb28b33a3 Merge branch 'master' into dev 2024-04-22 18:01:16 +03:00
AUTOMATIC1111 1c0a0c4c26 Merge branch 'dev' 2024-04-22 18:00:36 +03:00
AUTOMATIC1111 7dfe959f4b update changelog 2024-04-22 18:00:23 +03:00
AUTOMATIC1111 8f64dad282 Merge pull request #15594 from AUTOMATIC1111/fix-get_crop_region_v2
fix get_crop_region_v2
2024-04-22 17:57:39 +03:00
w-e-w 821adc3041 fix get_crop_region_v2
Co-Authored-By: Dowon <ks2515@naver.com>
2024-04-22 23:10:19 +09:00
AUTOMATIC1111 e2b177c508 Merge branch 'dev' 2024-04-22 12:26:24 +03:00
AUTOMATIC1111 e837124f4b changelog 2024-04-22 12:26:05 +03:00
AUTOMATIC1111 3fdc3cfbbf Merge pull request #15591 from AUTOMATIC1111/restore-1.8.0-style-naming-of-scripts
Restore 1.8.0 style naming of scripts
2024-04-22 12:24:06 +03:00
w-e-w e9809de651 restore 1.8.0-style naming of scripts 2024-04-22 18:23:58 +09:00
AUTOMATIC1111 61f6479ea9 restore 1.8.0-style naming of scripts 2024-04-22 12:19:30 +03:00
7 changed files with 30 additions and 7 deletions
+10
View File
@@ -1,3 +1,13 @@
## 1.9.3
### Bug Fixes:
* fix get_crop_region_v2 ([#15594](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15594))
## 1.9.2
### Extensions and API:
* restore 1.8.0-style naming of scripts
## 1.9.1
### Minor:
@@ -1,7 +1,7 @@
from modules import scripts
from modules.shared import opts
xyz_grid = [x for x in scripts.scripts_data if x.script_class.__module__ == "scripts.xyz_grid"][0].module
xyz_grid = [x for x in scripts.scripts_data if x.script_class.__module__ == "xyz_grid.py"][0].module
def int_applier(value_name:str, min_range:int = -1, max_range:int = -1):
"""
+1 -1
View File
@@ -16,7 +16,7 @@ def get_crop_region_v2(mask, pad=0):
mask = mask if isinstance(mask, Image.Image) else Image.fromarray(mask)
if box := mask.getbbox():
x1, y1, x2, y2 = box
return max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask.size[0]), min(y2 + pad, mask.size[1]) if pad else box
return (max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask.size[0]), min(y2 + pad, mask.size[1])) if pad else box
def get_crop_region(mask, pad=0):
+6 -2
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
@@ -62,11 +64,13 @@ def run_postprocessing(extras_mode, image, image_folder, input_dir, output_dir,
else:
image_data = image_placeholder
image_data = image_data if image_data.mode in ("RGBA", "RGB") else image_data.convert("RGB")
parameters, existing_pnginfo = images.read_info_from_image(image_data)
if parameters:
existing_pnginfo["parameters"] = parameters
initial_pp = scripts_postprocessing.PostprocessedImage(image_data if image_data.mode in ("RGBA", "RGB") else image_data.convert("RGB"))
initial_pp = scripts_postprocessing.PostprocessedImage(image_data)
scripts.scripts_postproc.run(initial_pp, args)
+1 -3
View File
@@ -8,9 +8,7 @@ loaded_scripts = {}
def load_module(path):
module_name, _ = os.path.splitext(os.path.basename(path))
full_module_name = "scripts." + module_name
module_spec = importlib.util.spec_from_file_location(full_module_name, path)
module_spec = importlib.util.spec_from_file_location(os.path.basename(path), path)
module = importlib.util.module_from_spec(module_spec)
module_spec.loader.exec_module(module)
+1
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)
+10
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