Tutorial moved to http://www.qgistutorials.com/en/docs/raster_mosaicing_and_clipping.html
Sometimes clipping a raster using a rectangle is not sufficient. You might want to clip the raster based on the boundary of your area of interest. In QGIS, there is an option to use a ‘Mask layer’ while clipping a polygon.
You will need a polygon layer which has the boundary of your area of interest. In this example, I would like to clip my raster using the country boundary for Australia. Load both the raster and the vector polygon layer in QGIS.
Open ‘Clipper’ tool from Raster → Extraction → Clipper
In the Clipper dialog, select the raster as the Input file. Then select the name and path for the output file. In the ‘Clipping mode’ section, select the Mask layer mode. Select the polygon layer as the Mask layer. Make sure the check-boxes for ‘No data value’ and ‘Load into canvas when finished’ are checked on. Click OK.
Once the process finishes, you will have a new raster which is clipped to the boundary of the polygon layer.