The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Only set LOAD_TRUNCATED_IMAGES when if the Image open fails.
comfyanonymous72508a8d1912
diff --git a/node_helpers.py b/node_helpers.pyindex 264bd4d50..60f8fa415 100644--- a/node_helpers.py+++ b/node_helpers.py@@ -1,4 +1,4 @@-from PIL import Image, ImageFile+from PIL import Image, ImageFile, UnidentifiedImageErrordef conditioning_set_values(conditioning, values={}):c = []@@ -11,14 +11,15 @@ def conditioning_set_values(conditioning, values={}):return cdef open_image(path):- try :- ImageFile.LOAD_TRUNCATED_IMAGES = False+ prev_value = None++ try:img = Image.open(path)-- except:+ except (UnidentifiedImageError, ValueError): #PIL issues #4472 and #2445+ prev_value = ImageFile.LOAD_TRUNCATED_IMAGESImageFile.LOAD_TRUNCATED_IMAGES = Trueimg = Image.open(path)-finally:- ImageFile.LOAD_TRUNCATED_IMAGES = False+ if prev_value is not None:+ ImageFile.LOAD_TRUNCATED_IMAGES = prev_valuereturn img