[GIS] How to Read&Write .tiff images in java using GDAL library

digital image processinggdalimagejava

I searched many sites to learn about this but I didn't find anything.

I need step by step process for reading .tiff monochromatic image in java using Gdal library.

Best Answer

I guess you have gdal and the bindings installed, and some coding ability, so I'll just provide an outline:

import org.gdal.gdal.gdal;
import org.gdal.gdal.Band;
import org.gdal.gdal.Dataset;

...
Dataset dataset = gdal.Open(filename);
Band band = dataset.GetRasterBand(1);
...
// Do some band operation, like band.ReadRaster() to get the data, whatever you need for your scenario.

There are more examples in the GDAL sources, like a Java equivalent of gdalinfo which will show you how to get the valuable metadata.

Also, make sure you read the Javadoc for whatever class you are using, and compare usage in the examples.