From ca317b85ba141cd5e95c0390efbcdce2d27fbe5d Mon Sep 17 00:00:00 2001 From: Austin Mroz Date: Wed, 24 Jan 2024 12:04:19 -0600 Subject: [PATCH] Fix overlaying on transparent gif output When saving a gif with transparency, the previous frame would display underneath the new one. This is fixed by setting the disposal flag. Resolves #141 --- videohelpersuite/nodes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/videohelpersuite/nodes.py b/videohelpersuite/nodes.py index 0ebea85..66e2a25 100644 --- a/videohelpersuite/nodes.py +++ b/videohelpersuite/nodes.py @@ -195,6 +195,9 @@ class VideoCombine: format_type, format_ext = format.split("/") if format_type == "image": + image_kwargs = {} + if format_ext == "gif": + image_kwargs['disposal'] = 2 file = f"{filename}_{counter:05}.{format_ext}" file_path = os.path.join(full_output_folder, file) images = tensor_to_bytes(images) @@ -210,6 +213,7 @@ class VideoCombine: duration=round(1000 / frame_rate), loop=loop_count, compress_level=4, + **image_kwargs ) output_files.append(file_path) else: