Skip to content

Instantly share code, notes, and snippets.

@dwilkins
Last active December 20, 2015 23:18
Show Gist options
  • Save dwilkins/6210975 to your computer and use it in GitHub Desktop.
Save dwilkins/6210975 to your computer and use it in GitHub Desktop.
Resize images and use the tileup gem to slice them up for a slippy map
imagename=$1
imagebasename=${imagename%.*}
size=512
for size in 512 1024 2048 4096 8192 16384
do
echo "Resizing to ${size}x${size}"
convert -size ${size}x${size} xc:transparent canvas.png
time composite -resize ${size}x${size} $1 -gravity center canvas.png -size ${size}x${size} "${imagebasename}-${size}.png"
ls -ltrh ${imagebasename}-${size}.png
time tileup --in="${imagebasename}-${size}.png" --output-dir=$size
rm "${imagebasename}-${size}.png"
done
mv 512 1
mv 1024 2
mv 2048 3
mv 4096 4
mv 8192 5
mv 16384 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment