Use Gdal2tiles to generate 512px tiles

Use Gdal2tiles to generate 512px tiles

I'm a newbie in gdal2tiles & python but I would like to modify gdal2tiles to create 512px tiles for retina display (screen).

Can someone suggest how I can do this?

This is an old question, but I needed the same thing and found a solution. I modified the file (as suggested by user30184). After changing all of the "256" values in the code to "512", I found that the modified gdal2tiles script did create the tiles in 512x512 resolution. I also tested this using MapBox and confirmed that the higher resolution tiles do display properly.

Recent versions of gdal2tiles (since 3.1.0) have a--tilesize=PIXELSoption.