mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-23 05:36:59 +08:00
Update node_helpers.py to include open_image helper function
open_image includes try except to catch Pillow Value Errors that occur when large ICC profiles are embedded in images.
This commit is contained in:
parent
fd763c9afd
commit
e8f0d40b6f
@ -1,3 +1,4 @@
|
|||||||
|
from PIL import Image, ImageFile
|
||||||
|
|
||||||
def conditioning_set_values(conditioning, values={}):
|
def conditioning_set_values(conditioning, values={}):
|
||||||
c = []
|
c = []
|
||||||
@ -8,3 +9,16 @@ def conditioning_set_values(conditioning, values={}):
|
|||||||
c.append(n)
|
c.append(n)
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
|
def open_image(path):
|
||||||
|
try :
|
||||||
|
ImageFile.LOAD_TRUNCATED_IMAGES = False
|
||||||
|
img = Image.open(path)
|
||||||
|
|
||||||
|
except:
|
||||||
|
ImageFile.LOAD_TRUNCATED_IMAGES = True
|
||||||
|
img = Image.open(path)
|
||||||
|
|
||||||
|
finally:
|
||||||
|
ImageFile.LOAD_TRUNCATED_IMAGES = False
|
||||||
|
return img
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user