[GIS] Generating JPEG tiles using gdal2tiles.py

gdalgdal2tilespngtiles

I am using gdal2tiles.py to generate tiles and packing it into MBTiles using mb-util.
gdal2tiles by default generates PNG tiles. When I convert PNG tiles to JPEG large black area around tiles are left (due to lack of transparency in JPEG):

http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=24048

Is there a way to directly generate JPEG tiles in gdal2tiles.py ?

I am using GDAL 1.9.2 on Ubuntu 12.04.

Best Answer

for resolve the problem of black areas is necessary to proceed this way:

1) create a virtual mosaic of the images with the param -vrtnodata 255: gdalbuildvrt test.vrt -vrtnodata 255 *.tif

this add a white background to the mosaic

see this explanation: http://lists.osgeo.org/pipermail/gdal-dev/2010-January/023032.html

2) download the correct prj file from http://spatialreference.org/

3) run gdal2tiles python3.4 /usr/local/bin/gdal2tiles.py -p raster -s 3003.prj -v test.vrt out

NOTE: with the official gdal2tiles is not possible to generate JPEG, only PNG.

has explained here in the last open source beta version of maptiler there was an upgraded version of gdal2tiles that permit to generate JPEG tiles.

https://trac.osgeo.org/gdal/ticket/5624

the option is –tile-format jpeg

the complete command is: python gdal2tilesNew.py --tile-format jpeg -p raster -s 3003.prj prova_white.vrt output_folder_white

THIS SEEMS TO BE A FORK OF THE LATEST VERSION OF GDAL2TILES

https://github.com/mj10777/mapmbtiles