#!/bin/bash
#wget -x https://tiles.telegeography.com/maps/middle-east-map-2018/5/{0..31}/{1..28}.png24

title="middle-east-map-2018"
pw="/home/sacha/telegeography/tiles.telegeography.com/maps/$title/5"
files=""

for i in {1..28}; do
	files="$files $i.png24"
done

for dir in $pw/*; do
	output=`echo ${dir##*/}`
	cd $dir
	convert $files -append ../$output.png	
done

files=""
for i in {1..31}; do
        files="$files $i.png"
done
cd $pw
convert $files +append /home/sacha/telegeography/$title.png


