#!/bin/sh
output=fotos.txt

mkdir -p icons
echo "lat\tlon\ttitle\tdescription\ticon\ticonSize\ticonOffset" > $output
i=0
for img in `find . -maxdepth 1 -mindepth 1 -type f -iname \*.jpg | sort` ; do
    i=$(($i+1))
    name=`basename $img | tr [A-Z] [a-z]`
    convert $img -geometry 120x80 icons/$name
    size=`exiftool -ImageSize icons/$name | sed 's/^.*: \([0-9]\+\)x\([0-9]\+\)/\1,\2/'`
    exiftool -coordFormat "%.4f" -GPSPosition $img | sed "s/^.*: \(.\+\) N, \(.\+\) E/\1\t\2\t$i\t$name\ticons\/$name\t$size\t0,0/" >> $output
done
