Leaflet with custom map (CRS) - how to convert JPG to TileLayer tiles

I'm looking for a similar solution. Sharing what all I've found from a web search. Yet to implement, but check them out and have a go. I searched on duckduckgo for "cut image into tiles for leaflet"


Showing Zoomify images with Leaflet - by Bjørn Sandvik. It'll be best to take the code from one of his examples and adapt it. And he's using this: http://www.zoomify.com/free.htm He's made a leaflet plugin to enable using tileset prepared by Zoomify: https://github.com/turban/Leaflet.Zoomify

Then, more stuff:

http://leafletjs.com/plugins.html#non-map-base-layers leaflet plugins for non-maps This lists the zoomify plugin mentioned above, and more options too:

https://github.com/alfarisi/leaflet-deepzoom leaflet plugin for Deepzoom images. https://www.microsoft.com/en-us/download/details.aspx?id=24819 Deep Zoom composer : windows app for generating tiles

This plugin seems to have the most complete solution, with a shell and python script to generate the image tiles: https://github.com/commenthol/leaflet-rastercoords
It uses a script, "gdal2tiles.py" to generate the tiles. https://github.com/commenthol/gdal2tiles-leaflet Usage example: command for an image whose larger dimension is 3000px:

python ./gdal2tiles.py -l -p raster -z 0-4 -w none karta.jpg tiles

there's a shell command for calculating the zoom extents (0-4 or 0-3 etc):

$ echo "l(3000/256)/l(2)" | bc -l

Update: An article/walkthrough where the author has tiled a very large image successfully and has a demo to show of it: https://medium.com/@jarednielsen/how-to-make-an-interactive-story-map-using-leaflet-and-non-geographical-images-821f49ff3b0d

It seems that libvips can also generate what is expected.

vips dzsave input.jpg output.zip --layout google