[download]

local/bin/rename-meta

   1 #!/bin/bash
   2 
   3 for file in "$@"; do
   4     r=$(identify -format '%wx%h' "$file" 2>&-)
   5     c=$(convert "$file" -scale 5% -colors 1 -unique-colors txt: |
   6     awk -F '[# ]+' 'NR > 1 { print substr($3, 0, 6) }' | paste -sd -)
   7 
   8     dir=$(dirname "$file")/ dir=${dir#./}
   9     mv -vn "$file" "$dir$c-$r.${file##*.}"
  10 done