简要说明
在java,简单使用gdal生成tif文件的缩略图
maven依赖
<!--需要安装完gdal后,本地install gdal包才能使用 --><!--gdal安装可参考 https://blog.csdn.net/qq_41613913/article/details/135743562 --><dependency><groupId>org.gdal</groupId><artifactId>gdal</artifactId><version>3.7.3</version></dependency>
样例代码
public static void main(String[] args) {String thumbPath = "D:/tmp/test.jpg";Dataset dataset = gdal.Open(dataPath);Vector vector = gdal.ParseCommandLine("-of JPEG -outsize 10% 10% -ot Byte -scale");TranslateOptions opt = new TranslateOptions(vector);gdal.Translate(thumbPath,dataset,opt);
}