mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-11 02:15:17 +00:00
Fix issue with loading some JPG: #3416
This commit is contained in:
parent
d7fa417bfa
commit
c33412288f
14
nodes.py
14
nodes.py
@ -10,7 +10,7 @@ import time
|
|||||||
import random
|
import random
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from PIL import Image, ImageOps, ImageSequence
|
from PIL import Image, ImageOps, ImageSequence, ImageFile
|
||||||
from PIL.PngImagePlugin import PngInfo
|
from PIL.PngImagePlugin import PngInfo
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -1462,7 +1462,17 @@ class LoadImage:
|
|||||||
output_images = []
|
output_images = []
|
||||||
output_masks = []
|
output_masks = []
|
||||||
for i in ImageSequence.Iterator(img):
|
for i in ImageSequence.Iterator(img):
|
||||||
i = ImageOps.exif_transpose(i)
|
prev_value = None
|
||||||
|
try:
|
||||||
|
i = ImageOps.exif_transpose(i)
|
||||||
|
except OSError:
|
||||||
|
prev_value = ImageFile.LOAD_TRUNCATED_IMAGES
|
||||||
|
ImageFile.LOAD_TRUNCATED_IMAGES = True
|
||||||
|
i = ImageOps.exif_transpose(i)
|
||||||
|
finally:
|
||||||
|
if prev_value is not None:
|
||||||
|
ImageFile.LOAD_TRUNCATED_IMAGES = prev_value
|
||||||
|
|
||||||
if i.mode == 'I':
|
if i.mode == 'I':
|
||||||
i = i.point(lambda i: i * (1 / 255))
|
i = i.point(lambda i: i * (1 / 255))
|
||||||
image = i.convert("RGB")
|
image = i.convert("RGB")
|
||||||
|
Loading…
Reference in New Issue
Block a user