From ef29c127f8d464e702576bbb9a1c88e2115ec4ab Mon Sep 17 00:00:00 2001 From: shawnington <88048838+shawnington@users.noreply.github.com> Date: Sun, 21 Apr 2024 10:14:39 -0700 Subject: [PATCH] Fix issue with how PIL loads small PNG files nodes.py Added flag to prevent ValueError: Decompressed Data Too Large when loading PNG images with large meta data such as large embedded color profiles --- nodes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index 28359e939..6a5b8de62 100644 --- a/nodes.py +++ b/nodes.py @@ -10,8 +10,11 @@ import time import random import logging -from PIL import Image, ImageOps, ImageSequence +from PIL import Image, ImageOps, ImageSequence, ImageFile from PIL.PngImagePlugin import PngInfo + +ImageFile.LOAD_TRUNCATED_IMAGES = True + import numpy as np import safetensors.torch