rm -f ${dest}/frame*.png
-# Extract global frame:
-convert ${IM_OPS} ${src}[1] ${dest}/psd0.png
-
-cp ${dest}/psd0.png ${dest}/temp.png
+# Create background frame:
+convert -size ${size} xc:none ${dest}/background.png
# Remove first line (Layer 558):
${SED} -i -e '1d' ${layers}
# Will start at frame 2 at first loop iteration
f=1
+files=""
+
while read l; do
f=$((${f} + 1))
continue
fi
- convert ${IM_OPS} ${src}[${f}] ${dest}/psd${f}.png
-
- composite ${IM_OPS} -geometry ${p} ${dest}/psd${f}.png ${dest}/temp.png ${dest}/temp.png
+ files="${files} -page ${p} ${src}[${f}]"
-if [ x"${nf}" != x"" ]; then
+ if [ x"${nf}" != x"" ]; then
log_dbg "New frame ID: ${nf}"
- cp ${dest}/temp.png ${dest}/f${nf}.png
- cp ${dest}/psd0.png ${dest}/temp.png
+ convert -page +0+0 ${dest}/background.png ${files} -background none -layers merge ${dest}/f${nf}.png
+ files=""
fi
+
done <${layers}
if which ffmpeg 1> /dev/null 2>&1; then
# Conversion vidéo:
ffmpeg -y -r ${fps} -start_number 1 -i ${dest}/f%d.png ${dest}/sequence.mp4
fi
-
-rm -f ${dest}/temp.png
-
-#rm -f ${dest}/psd*.png