# Will start at frame 2 at first loop iteration
f=1
+ nf=""
+ oldnf=""
files=""
while read l; do
files="${files} -page ${p} ${src}[${f}]"
if [ x"${nf}" != x"" ]; then
+ # Only check expected frame if oldnf is set...
+ if [ x"${oldnf}" != x"" ]; then
+ expected_nf=$((${oldnf} + 1))
+
+ if [ ${expected_nf} -ne ${nf} ]; then
+ echo "Error: invalid frame sequence: ${nf}"
+ echo " previous: ${oldnf}"
+ echo " expected: ${expected_nf}"
+ files=""
+ continue
+ fi
+ fi
+
log_dbg "New frame ID: ${nf}"
convert -colorspace sRGB -page +0+0 ${dest}/background.png ${files} -background none -layers merge ${dest}/f${nf}.png
files=""
+ oldnf="${nf}"
fi
done <${layers}
fi