I am currently trying to use leaflet to display images (jpeg or png) instead of maps, I have followed the instructions on this blog post to create the tiles using gdal2tiles.py here is the code we used

gdal2tile.py -p raster -z 0-5 -w none "SOURCE_PATH.png" "DESTINATION_FOLDER"

The command produces the necessary tiles for leaflet, but the problem is that it takes around 2 minutes to create tiles for the attached image (size: 777KB, resolution: 2592x1728) and a disastrous number of tiles of around 1600 file.

I am trying to optimize the time and number of files to generate tiles for leaflet and looking for suggestions, please help.


1 Answer 1


you could use TileMill to generate the tiles, this outputs all the tiles into one file, in a format called mbtiles, that's easier to use, the downside is that you can't just drop the folder onto a web server, but there are quite a few programs that can deal with the file as its just sqlite3.

You could also look at huge pic which seems to be doing something similar to what you are trying.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.