".github/vscode:/vscode.git/clone" did not exist on "d83db2abcd205e662523164606f53350828c1120"
node_helpers.py 545 Bytes
Newer Older
1
from PIL import Image, ImageFile
2
3
4
5
6
7
8
9
10
11

def conditioning_set_values(conditioning, values={}):
    c = []
    for t in conditioning:
        n = [t[0], t[1].copy()]
        for k in values:
            n[1][k] = values[k]
        c.append(n)

    return c
12
13
14
15
16
17
18
19
20
21
22
23
24

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