I have a lot of 4 bands rasters with bands: blue-green-red-NIR, and I need to create 3 bands rasters with bands: red-green-blue. How I can automizate this process using QGIS?


Use gdal_translate from the command line https://www.gdal.org/gdal_translate.html as

gdal_translate -of GTiff -b 3 -b 2 -b 1 input_4band.tif output_RGB.tif possibly with advanced parameters supported by the GeoTIFF driver https://www.gdal.org/frmt_gtiff.html.

  • Thank you, I tried, but failed – Tima Orlov Jan 9 at 13:29
  • File "<input>", line 1 gdal_translate -of GTiff -b 3 -b 2 -b 1 f:\temp\LC08_L1TP_171021_20180526.tif f:\temp\rgb\LC08_L1TP_171021_20180526.tif ^ SyntaxError: invalid syntax – Tima Orlov Jan 9 at 13:29
  • How did you launch gdal_translate? You should run it from the Windows command window of Linux shell. You seem to use Windows, how did you install QGIS? If you have used OSGeo4W installer open the "OSGeo4W Shell" and run the command from there. – user30184 Jan 9 at 13:35
  • Oh! thanks great! I'm a novice in it. How can I run it for all my files in one step? – Tima Orlov Jan 9 at 13:49
  • That's not really a GIS thing, but something like for %1 in (*.tif) do (gdal_translate -of GTiff -b 3 -b 2 -b 1 %1 RGB_%1) should work. – user30184 Jan 9 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.