From a710d12c5fc45b0614e508f3cd97c4638365573d Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 3 Mar 2021 12:05:26 +0100 Subject: [PATCH] moved composite_images to pype's tvpaint.lib --- pype/hosts/tvpaint/lib.py | 17 +++++++++++++++++ .../tvpaint/plugins/publish/extract_sequence.py | 17 +---------------- 2 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 pype/hosts/tvpaint/lib.py diff --git a/pype/hosts/tvpaint/lib.py b/pype/hosts/tvpaint/lib.py new file mode 100644 index 0000000000..8172392c7f --- /dev/null +++ b/pype/hosts/tvpaint/lib.py @@ -0,0 +1,17 @@ +from PIL import Image + + +def composite_images( + input_image_paths, output_filepath, scene_width, scene_height +): + img_obj = None + for image_filepath in input_image_paths: + _img_obj = Image.open(image_filepath) + if img_obj is None: + img_obj = _img_obj + else: + img_obj.alpha_composite(_img_obj) + + if img_obj is None: + img_obj = Image.new("RGBA", (scene_width, scene_height), (0, 0, 0, 0)) + img_obj.save(output_filepath) diff --git a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py index 847292814d..d33ec3c68c 100644 --- a/pype/hosts/tvpaint/plugins/publish/extract_sequence.py +++ b/pype/hosts/tvpaint/plugins/publish/extract_sequence.py @@ -4,25 +4,10 @@ import tempfile import pyblish.api from avalon.tvpaint import lib +from pype.hosts.tvpaint.lib import composite_images from PIL import Image -def composite_images( - input_image_paths, output_filepath, scene_width, scene_height -): - img_obj = None - for image_filepath in input_image_paths: - _img_obj = Image.open(image_filepath) - if img_obj is None: - img_obj = _img_obj - else: - img_obj.alpha_composite(_img_obj) - - if img_obj is None: - img_obj = Image.new("RGBA", (scene_width, scene_height), (0, 0, 0, 0)) - img_obj.save(output_filepath) - - class ExtractSequence(pyblish.api.Extractor): label = "Extract Sequence" hosts = ["tvpaint"]