Compare commits

...

3 Commits

Author SHA1 Message Date
Ray Suhyun Lee
42ca61824b
Merge b947b5a4a3 into d1b9822f74 2026-01-05 08:39:29 +01:00
Ray Suhyun Lee
b947b5a4a3 fix other conditions as well 2023-09-28 18:23:58 +09:00
Ray Suhyun Lee
297757778d fix /view returning image with wrong orientation 2023-09-28 17:49:35 +09:00

View File

@ -502,6 +502,7 @@ class PromptServer():
if os.path.isfile(file):
if 'preview' in request.rel_url.query:
with Image.open(file) as img:
img = ImageOps.exif_transpose(img)
preview_info = request.rel_url.query['preview'].split(';')
image_format = preview_info[0]
if image_format not in ['webp', 'jpeg'] or 'a' in request.rel_url.query.get('channel', ''):
@ -527,6 +528,7 @@ class PromptServer():
if channel == 'rgb':
with Image.open(file) as img:
img = ImageOps.exif_transpose(img)
if img.mode == "RGBA":
r, g, b, a = img.split()
new_img = Image.merge('RGB', (r, g, b))
@ -542,6 +544,7 @@ class PromptServer():
elif channel == 'a':
with Image.open(file) as img:
img = ImageOps.exif_transpose(img)
if img.mode == "RGBA":
_, _, _, a = img.split()
else: