mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-04 11:12:35 +00:00
add images.read to automatically fix all jpeg/png weirdness
This commit is contained in:
@@ -8,7 +8,7 @@ import sys
|
||||
|
||||
import gradio as gr
|
||||
from modules.paths import data_path
|
||||
from modules import shared, ui_tempdir, script_callbacks, processing, infotext_versions
|
||||
from modules import shared, ui_tempdir, script_callbacks, processing, infotext_versions, images
|
||||
from PIL import Image
|
||||
|
||||
sys.modules['modules.generation_parameters_copypaste'] = sys.modules[__name__] # alias for old name
|
||||
@@ -83,7 +83,7 @@ def image_from_url_text(filedata):
|
||||
assert is_in_right_dir, 'trying to open image file outside of allowed directories'
|
||||
|
||||
filename = filename.rsplit('?', 1)[0]
|
||||
return Image.open(filename)
|
||||
return images.read(filename)
|
||||
|
||||
if type(filedata) == list:
|
||||
if len(filedata) == 0:
|
||||
@@ -95,7 +95,7 @@ def image_from_url_text(filedata):
|
||||
filedata = filedata[len("data:image/png;base64,"):]
|
||||
|
||||
filedata = base64.decodebytes(filedata.encode('utf-8'))
|
||||
image = Image.open(io.BytesIO(filedata))
|
||||
image = images.read(io.BytesIO(filedata))
|
||||
return image
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user