This commit is contained in:
Ray Suhyun Lee 2025-04-15 03:31:33 +00:00 committed by GitHub
commit 6b5700a5bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -417,6 +417,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', ''):
@ -442,6 +443,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))
@ -457,6 +459,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: