I have two rasters (raster1 and raster2). The raster1 extent is smaller than raster2. I want to replace the value of raster2 pixels using raster1 pixels. How can I replace the values?
Is it acceptable for you to use GDAL? If it is then you can do what you want with gdalwarp http://www.gdal.org/gdalwarp.html
The command to use is
gdalwarp raster1.tif raster2.tif
Command will write data from source image "raster1.tif" into target image "raster2.tif" and if the target image already exists and is of such a format that can be updated then pixels from raster1 will be written over the original pixels. Uncompressed geotiff is good for the output format. You can compress or convert the updated image afterwards if needed.