Last Updated: February 25, 2016
· timurkhafizov

Tiling images for Google Maps with Imagemagick

We have had a project with custom maps made upon Google Maps Engine.
GME requires us to tile images for dynamic load.
Let's imagine that we have only 1 zoom level and 1000x1000 image for it.

We decided to tile it to 250x250 images. Of course imagemagick totally covers all our needs. You can tile images as simple as:

convert image.jpg -crop 250x250 ./tiles/tile.jpg

In this case imagemagick will tile images and place it to tiles dir and name them as tile-0.jpg, etc.
But GME asks us to use another naming format:


You can either rename all tiles or use imagemagick built-in filename formatting.
We decided to use the second approach. So this is how we managed to tile image for maps:

convert image.jpg -crop 250x250 +gravity \
-set filename:tile ./tiles/tile_%[fx:page.x/250]-%[fx:page.y/250] \

Hope it helps you to save some time when tiling images for Google Maps

Say Thanks