# Arg1: layer
function get_pos()
{
- cat ${layers} | grep "${1}" | ${SED} "s/.*geometry:[0-9]\+x[0-9]\+\(+[0-9]\+[0-9]\+\)/\1/g"
+ cat ${layers} | grep "${1}" | ${SED} "s/.*geometry:[0-9]\+x[0-9]\+\(+[0-9]\++[0-9]\+\),.*/\1/g"
}
# Arg1: line
function get_label()
{
- frame=$(echo "${1}" | grep -e "label:.*," | ${SED} "s/label:\(.*\),.*/\1/g")
+ frame=$(echo "${1}" | ${SED} "s/.*label:\(.*\),geometry.*/\1/g")
if [ x"${frame}" = x"" ]; then
echo ""
# Arg1: line
function get_frame_id()
{
- frame=$(echo "${1}" | grep -e "label:[0-9]\+," | ${SED} "s/label:\([0-9]\+\),.*/\1/g")
+ frame=$(echo "${1}" | grep -e "label:[0-9]\+," | ${SED} "s/.*label:\([0-9]\+\),.*/\1/g")
if [ x"${frame}" = x"" ]; then
echo ""
fi
}
+# Arg1: line
+function get_scene_id()
+{
+ local token
+ token=$(echo "${1}" | ${SED} "s/.*scene:\([0-9]\+\),.*/\1/g")
+ echo "${token}"
+}
+
# Arg1: label
function is_skip_label()
{
done
if [ ${trames} -eq 1 ]; then
- identify ${IM_OPS} -verbose -format "label:%l,geometry:%g\n" ${src} > ${layers}
+ # %s: scene number
+ identify ${IM_OPS} -verbose -format "scene:%s,label:%l,geometry:%g,\n" ${src} > ${layers}
- # Ignore empty labels:
+ # Remove line(s) with empty label:
${SED} -i -e /label:,.*/d ${layers}
# Extract global frame size:
# Create background frame:
convert -size ${size} xc:none ${dest}/background.png
- # Will start at frame 2 at first loop iteration
- f=1
-
nf=""
oldnf=""
files=""
while read l; do
- f=$((${f} + 1))
-
+ scene=$(get_scene_id "${l}")
label=$(get_label "${l}")
p=$(get_pos "${l}")
nf=$(get_frame_id "${l}")
- log_dbg "Couche ${f}"
+ log_dbg "Layer ${scene}"
log_dbg " nom: ${label}"
log_dbg " pos: ${p}"
continue
fi
- files="${files} -page ${p} ${src}[${f}]"
+ files="${files} -page ${p} ${src}[${scene}]"
if [ x"${nf}" != x"" ]; then
# Only check expected frame if oldnf is set...