So I am trying to batch save 100's of styled rasters. I have managed to save a single raster in the python console using the following code:
layer = iface.activeLayer()
extent = layer.extent()
width, height = layer.width(), layer.height()
renderer = layer.renderer()
provider=layer.dataProvider()
crs = layer.crs().toWkt()
pipe = QgsRasterPipe()
pipe.set(provider.clone())
pipe.set(renderer.clone())
file_writer = QgsRasterFileWriter('e:/Data/output.tif')
file_writer.writeRaster(pipe,
width,
height,
extent,
layer.crs())
What do I need to add so I can save all the rasters currently open in QGIS?