Question: Given two input layers

1. The clip layer - an arbitrary layer (though in my case it's a float 1 band geotiff)
2. The mask layer - a paletted *raster* in which every pixel is either NO DATA or a single "color" value, same for every pixel.

I want to create an output raster whose overall extent matches the extent of the mask layer and each pixel is either NO DATA if the corresponding pixel of the mask layer is NO DATA or the value of the corresponding pixel from the clip layer if the corresponding pixel of the mask layer is not NO DATA.

I know I can mask the clip layer with a polygon, but the mask layer is a raster. Polygonizing the raster layer is possible in principle, but would result in a polygon with a lot of very short edges.

Is there a direct way to do this in QGIS?

I suppose there's probably a path that involves creating a new layer and using the raster calculator, but I'm hoping there's something more direct. Further complicating the matter is that the two rasters might not have the same resolution and origin.

I believe this is equivalent to [Extract by Mask](http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Extract_by_Mask/009z0000002n000000/) in ArcMap.

Answer: 
I don't have enough rep to comment, but I would like to share what worked with me after spending quite some time! After following @MappaGnosis advice, I used raster calculator 4 times (because I had a 4-band image) and following the exact same process, changing the bands used in the raster calculator, ended up with 4 images whose extent were equal to the raster we wanted to clip by and (as each resulting raster has only 1 band) the value of those bands were from the raster we wanted to clip.

To sum it up, all I did was:

```
(maskLayer@1 >= 0) * clipLayer@1
(maskLayer@2 >= 0) * clipLayer@2
(maskLayer@3 >= 0) * clipLayer@3
(maskLayer@4 >= 0) * clipLayer@4

```

Then, we can build a virtual raster with those 4 files (don't forget to tick the "place each file in separate band") and voilá! Export the virtual raster and it's done.
A way around.

Mask raster layer > Processing > Raster values to points (Saga)

Creates a shapefile with a mosaic of polygons (usually squares), one for each pixel of the mask layer.

Edit mode >> select all polygons in the shapefile >> Advanced digitizing toolbar >> Merge selected features

A single polygon is created that mimics exactly the outline of the mask raster layer. Now you can use the standard "Clip raster by mask layer" command.