Skip to content

Instantly share code, notes, and snippets.

@rincewind
Created August 11, 2011 14:04
Show Gist options
  • Save rincewind/1139727 to your computer and use it in GitHub Desktop.
Save rincewind/1139727 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
set -u
start=1
if [ $# -eq 2 ]
then
start=$2
fi
numlayer=`convert "$1" -format "%[scenes]" info: | head -n 1`
echo "${numlayer} layers"
for i in `seq $start $numlayer`
do
label=`convert "$1"[$i] -verbose info: | grep "label:" | cut -d: -f 2 `
echo "[${i}/${numlayer}] label: ${label}"
convert "$1"[$i] "${label:1}-$i-$1.png"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment