利用Translate创建缩略图功能,指定缩略图宽度为1024,等比例缩放
命令行:
gdal_translate -of JEPG -outsize 10% 10% geotiff.tif thumb.jpeg
python代码实现:
def create_thumb(tif_path, thumb_path, width):
print("开始创建缩略图...")
options = "-of JEPG -outsize 10% 10%"
gdal.Translate(thumb, cog_tif, options=options)