For this example, I have 3 tif images that are tiles. They fit together to form a single image.

I load the 3 images into QGIS and it merges them directly and I see my completed image.

The problem is I need to export it to a single geotiff image. I can only get it to export one of the layers (tiles). I need to essentially merge the layers into a single layer and then export that layer (or something like that)


The tutorial in the answer posted by Venug uses the Raster > Miscellaneous > Merge functionality. What I don't like about that method is that it requires you to find the files you want to merge in your file system. This can be tedious in a directory with hundreds of files. I prefer to use the Processing tools, which use the layers as inputs.

Here I have an example with three rasters loaded. I will demonstrate how to merge these using the QGIS Processing algorithms.

Example with three rasters

Step 1: Convert paletted files to RGB or RGBA

If your TIF files are paletted, you will need to first convert them to RGB or RGBA. If they are already in one of those formats, you can skip this step. If you are not sure, open the layer properties window and click on the Style tab. If it's paletted, it should say so next to 'Render type'. If it's multiband color, singleband grayscale or singleband pseudocolor, it should merge just fine without conversion and you can skip ahead to step 2.

Paletted example

From the menu, choose 'Processing > Toolbox...'. This should open a panel next to the map canvas. Find the translate algorithm in the Processing toolbox

Click the drop-down list at the bottom to select 'Advanced interface'. In the search box at the top, type 'translate'. Double-click the translate function under the GDAL algorithms.

To speed things up, click the 'Run as batch process...' button on the top right. The batch screen will load. Click the ellipsis button (...) In the 'Input layer' column on the first row. In the context menu that opens, choose 'Select from open layers'. Click 'Select all', then 'OK'.

Select layers

Click the drop-down in the Expand column for each row, and select 'rgba'.

Set Expand to rgba

In the Converted column, click the ellipsis next to the field in the first row, and choose a directory and file name for the converted images. You can give it a base name, say 'convert', and when it prompts you for autofill options, choose 'Fill with numbers'. This will auto-name the output files with incremental numbers. Click the 'Run' button to convert the images.

Choose output file names for converted images

Step 2: Merge raster layers

In the same way that you searched for the Translate algorithm, type 'merge' in the Processing search box and double-click on 'Merge' under the GDAL algorithms. Click the ellipsis next to the 'Input layers' selector, select the layers you want to merge (the 'Converted' layers if you followed step 1, otherwise 'Select all') and click 'OK'. If you'd like to save the merged file, click the ellipsis next to the 'Merged' selector and choose an output file name and location. Click 'Run' to start the merging process.

Merge layers

The result should look something like this:


If there were some areas not covered by the input files, as in this example, you may see black pixels in the gaps. This is because you can't set a default nodata value with the Processing merge function (at least as of QGIS 2.12.2). You will need to either set an extra nodata value in the layer style, or, more permanently, run Translate again on the merge file and set the nodata value to be 0. The black areas will then be transparent again.

| improve this answer | |
  • Thank you both for your input but using either method when I attempt to merge the 3 images Qgis freezes up I get a crash error or "python quit working" error. The 3 files total about 150mb – user72639 May 5 '16 at 17:53
  • That happens to me every time I use the method as well. Even after it says that the new file should be in location you set it to and will be completed. In other words, the algorithm worked, check in your folder. – Shub Jun 14 '17 at 14:51

I hope below link will help you to complete the task as you want..


| improve this answer | |
  • This seems like a solution I will try it out tomorrow. – Nick May 5 '16 at 5:00

Not an answer as such, but a couple of tips.

You can merge all files in a directory if you check the 'use input directory instead of files' option in the Merge dialog. I do this all the time for OS open data, which comes in folders with 100 images each.

If you're having problems calling Merge from QGIS, I suggest you fill in the merge dialog, but don't click on OK.

Instead, copy the command at the bottom of the dialog to the clipboard with CtrlC. (If that doesn't work, click on the pencil icon, it'll make the command textbox editable)

Then paste this into a terminal window (linux) or OSGEO4W Shell (Windows) and run it from there. If it's taking a long time, QGIS can appear unresponsive as it doesn't provide progress feedback. But run from the command line, you get a progress bar.

If it crashes doing it this way, the problem's in GDAL. If it doesn't, the problem's in QGIS. From the sounds of it, I doubt file size is the issue here.

Doing it this way means you'll need to add the result back into QGIS yourself, though.

| improve this answer | |

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.