From 3157f69c0e05b843cfe81136c4448f9810d09ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20Sch=C3=BCller?= Date: Tue, 26 Mar 2019 15:46:42 +0100 Subject: [PATCH] Save frames of the contact sheet (#59) * add feature to save frames of the contact sheet * add cleaning up temporary files message --- vcsi/vcsi.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/vcsi/vcsi.py b/vcsi/vcsi.py index 479f26d..2479e11 100755 --- a/vcsi/vcsi.py +++ b/vcsi/vcsi.py @@ -9,6 +9,7 @@ import os import subprocess import sys +import shutil from concurrent.futures import ThreadPoolExecutor try: @@ -1402,7 +1403,12 @@ def main(): "--fast", action="store_true", help="Fast mode. Just make a contact sheet as fast as possible, regardless of output image quality. May mess up the terminal.", - dest="fast" + dest="fast") + parser.add_argument( + "-to", "--thumbnail_output", + help="Save thumbnail files to output directory. If set, the thumbnail files will not be deleted after successful creation of the contact sheet.", + default="", + dest="thumbnail_output_path" ) args = parser.parse_args() @@ -1558,6 +1564,15 @@ def process_file(path, args): is_save_successful = save_image(args, image, media_info, output_path) + # save selected frames of the contact sheet to the predefined location in thumbnail_output_path + thumbnail_output_path = args.thumbnail_output_path + if thumbnail_output_path != "" and os.path.isdir(thumbnail_output_path): + print("Copy thumbnails...") + for i, frame in enumerate(selected_frames): + print(frame.filename) + thumbnail_file_extension = frame.filename.lower().split(".")[-1] + shutil.copyfile(frame.filename, thumbnail_output_path + os.path.basename(path) + '.' + str(i).zfill(4) + '.' + thumbnail_file_extension) + print("Cleaning up temporary files...") cleanup(temp_frames)