mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-22 12:37:04 +08:00
Merge remote-tracking branch 'upstream/master' into cleanup_if_idle
This commit is contained in:
commit
da0aa328a3
@ -1,3 +1,4 @@
|
||||
from PIL import Image, ImageFile, UnidentifiedImageError
|
||||
|
||||
def conditioning_set_values(conditioning, values={}):
|
||||
c = []
|
||||
@ -8,3 +9,17 @@ def conditioning_set_values(conditioning, values={}):
|
||||
c.append(n)
|
||||
|
||||
return c
|
||||
|
||||
def open_image(path):
|
||||
prev_value = None
|
||||
|
||||
try:
|
||||
img = Image.open(path)
|
||||
except (UnidentifiedImageError, ValueError): #PIL issues #4472 and #2445
|
||||
prev_value = ImageFile.LOAD_TRUNCATED_IMAGES
|
||||
ImageFile.LOAD_TRUNCATED_IMAGES = True
|
||||
img = Image.open(path)
|
||||
finally:
|
||||
if prev_value is not None:
|
||||
ImageFile.LOAD_TRUNCATED_IMAGES = prev_value
|
||||
return img
|
||||
|
||||
6
nodes.py
6
nodes.py
@ -12,12 +12,12 @@ import logging
|
||||
|
||||
from PIL import Image, ImageOps, ImageSequence
|
||||
from PIL.PngImagePlugin import PngInfo
|
||||
|
||||
import numpy as np
|
||||
import safetensors.torch
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
|
||||
|
||||
|
||||
import comfy.diffusers_load
|
||||
import comfy.samplers
|
||||
import comfy.sample
|
||||
@ -1456,7 +1456,9 @@ class LoadImage:
|
||||
FUNCTION = "load_image"
|
||||
def load_image(self, image):
|
||||
image_path = folder_paths.get_annotated_filepath(image)
|
||||
img = Image.open(image_path)
|
||||
|
||||
img = node_helpers.open_image(image_path)
|
||||
|
||||
output_images = []
|
||||
output_masks = []
|
||||
for i in ImageSequence.Iterator(img):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user