What might work is to rotate the raster in qgis and then export it. That would by far be the easiest.
If the tif file is stored with a tfw world file, you should be able to rotate the raster by editing the tfw file. The format is relatively simple, e.g. https://en.wikipedia.org/wiki/World_file.
I would guess your tfw file looks something like
As you noticed from the gdal2tiles documentation https://gdal.org/programs/gdal2tiles.html, the Python script deals well only with 8-bit input images.
Inputs with non-Byte data type (i.e. Int16, UInt16,…) will be
clamped to the Byte data type, causing wrong results. To awoid this it
is necessary to rescale input to the Byte data type using
Despite the age of this question, this might help other people. Working a lot on webproject with GeoJSONs, I had this issue frequently. My solution: The GeoJSON-related filetype BrokJSON (brokjson.dev). Depending on your GeoJSON it can reduce the size dramatically without loosing any data.
Look at this GeoJSON with two points and some data:
GeoServer creates tiles of rendered WMS maps using GeoWebCache where as the GeoTools tutorial you found is splitting up an existing GeoTiff. These are different processes with as you note different outputs.
However, there is no difficulty in using GeoTools to split a GeoTiff into png or jpg images using the tutorial code. You simply need to change the ...
A workaround with gdal2tiles could be to create a virtual mosaic file that covers your area of interest with gdal_translate, and then run gdal2tiles for the .VRT file.
Documentation is in https://gdal.org/programs/gdal_translate.html and you probably would like to use parameter -projwin
-projwin <ulx> <uly> <lrx> <lry>
I've got gpkg and shp that I created with some QGIS PLUGINS (QGIS 2.18X not avaialble on 3x) beyond level 14 it's only regional not worldwide.we use it to debug go to a certain tile number that version and the plugins are still available