I have two 8bit unsigned integer 4-band raster images that overlap (Raster 1 and Raster 2). One of the images is slightly smaller than the other (Raster 1). How can I extend the extent of the smaller raster (Raster 1) to match the extent of the larger raster (Raster 2)? The extended area in Raster 1 should contain 0 values for all the bands. NoData values are not wanted in this case. I use ArcGIS/Spatial Analyst, QGIS and any open source tools.
You can use gdalwarp, such as:
gdalwarp -of GTiff -te minx miny maxx maxy input.tif output.tif
You can get the extents using:
Hopefully Orfeo ToolBox is also on your list, of which Superimpose function fits smaller raster (your Raster 1) to a larger raster (your Raster 2).
(Allow me to show it in Monteverdi GUI, as I am not good at using it in QGIS processing - OTB mode).
There is a
Fill Value option which fills the outside of smaller raster by the user defined value (coincidentally, default value is 0.0).
extentvariable in the environment settings should be enough. For example
arcpy.env.extent = 'Raster2.tif'