[GIS] Gdal: How iterate through all pixels of a raster image

digital image processinggdalogrrastertopography

Given a topographic raster image.

How to iterate through all pixels of this raster image ?

Solution preferably with gdal, in console. Some other libraries/script could be installed.


Related: Gdal: How to get a pixel's value from raster image?, How to conditionnally assign a new value to pixels of a raster image?.

Best Answer

If by "using GDAL" you include writing code using the library as opposed to the more limited capabilities available only using the utilities from the command line, then the GDAL API tutorial walks you through all the steps to open a raster image, access its various properties (size, # of bands, rotation/skew, etc), and finally how to read and write a rasterband using the GDALRasterBand::RasterIO method. At this point you can do anything your programming language (and programming skills) allow.