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"]