gdal2tilesin a command line
git clone https://gist.github.com/5ccb92134a2e2dbf78874cebd9ecff48.git leaflet-gdal2tiles cd leaflet-gdal2tiles
# If you have wget wget -O btv1b53095142n_f1.jpg https://gallica.bnf.fr/iiif//ark:/12148/btv1b53095142n/f1/full/full/0/native.jpg # Else if you have CURL curl -o btv1b53095142n_f1.jpg https://gallica.bnf.fr/iiif//ark:/12148/btv1b53095142n/f1/full/full/0/native.jpg # else if no wget, no CURL, open in a browser # https://gallica.bnf.fr/iiif//ark:/12148/btv1b53095142n/f1/full/full/0/native.jpg and save file as btv1b53095142n_f1.jpg
gdal2tiles.py -p raster btv1b53095142n_f1.jpg tiled/ # If version of GDAL >= 2.3.x, to run in parallel gdal2tiles.py --processes=4 -p raster btv1b53095142n_f1.jpg tiled/
FIY, the center we use to set the center is by default [0, 0]. To determine, min and max zooms, see directory names in tiled folder.
They are number the min is 0 and the max is 6. These numbers are useful to change
maxZoom options in Leaflet sample code
index.html when using this recipe for your own images.
See link about “Learn how to serve local files with “localhost” using one liners” in Prerequisites section and run the following :
Open your browser at http://localhost:8080 to see the following:
You can see also see the live demo