From: Hugo Villeneuve Date: Wed, 25 Oct 2023 20:33:26 +0000 (-0400) Subject: Add global frames and video generation X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=refs%2Fheads%2Flatest;p=fgen.git Add global frames and video generation --- diff --git a/fgen.sh b/fgen.sh index 5ffb9d7..5cdc85f 100755 --- a/fgen.sh +++ b/fgen.sh @@ -175,6 +175,8 @@ function generate_video() png_files=$(ls ${dest}/${dest}-${group}-f*.png 2> /dev/null || echo "") if [ x"${png_files}" != x"" ]; then + group_list="${group_list} ${group}" + log_dbg "generate_video start" local outfile @@ -192,6 +194,50 @@ function generate_video() fi } +function generate_global() +{ + local g + local w + local files + local group + local fname + + log_dbg "generate_global: start" + log_dbg " list: ${group_list}" + log_dbg " max_nf: ${max_nf}" + + for w in $(seq 1 ${max_nf}); do + files="" + + for g in ${group_list}; do + group=${g} + fname=$(get_frame_name ${w}) + + if [ -f "${fname}" ]; then + files="${files} ${fname}" + fi + done + + if [ "${files}" != "" ]; then + group="global" + fname=$(get_frame_name ${w}) + + if [ ${dry_run} -eq 1 ]; then + touch ${fname} + else + convert -colorspace sRGB -page +0+0 ${dest}/background-white.png \ + ${files} -background none -layers merge \ + PNG32:${fname} + fi + fi + done + + group="global" + generate_video + + log_dbg "generate_global: end" +} + print_usage() { echo "${PROG_NAME} -- Générateur de séquence d'images PNG à partir d'un fichier Photoshop (PSD/PSB)." @@ -293,14 +339,18 @@ if [ ${trames} -eq 1 ]; then # Remove background line: ${SED} -i -e /label:${bg_layer_name},.*/d ${layers} - # Create background frame: + # Create transparent background frame: convert -size ${size} xc:none ${dest}/background.png + # Create white background frame: + convert -size ${size} xc:white ${dest}/background-white.png + nf="" max_nf="0" oldnf="" files="" group="default" + group_list="" while read l; do scene=$(get_scene_id "${l}") @@ -400,3 +450,5 @@ fi # Special case for last group... generate_video + +generate_global