Coming soon in QGIS 2.0 – blend modes for layers

I’ve just pushed my first major contribution to QGIS — the ability to set the compositing mode for a layer. Compositing is a technique widely used by cartographers and graphic artists to fine tune how layers are blended together, and it allows for some spectacular results! Until now, the only way to get these effects would be to export a map to a separate editor like Photoshop or GIMP and playing with the layer modes there. But with QGIS 2.0, blending can be controlled via a simple drop down menu for both raster and vector layers:

Blending modes for a raster layer
Woohoo… blending modes in QGIS!

So what makes this so great? Well, in previous versions the only option for compositing layers in QGIS was by setting a layer’s opacity. This approach has some limitations. Let’s say you want to overlay two raster layers – a basemap layer and a heatmap. You could place the heatmap layer over the basemap and set its transparency at 50% so that the basemap shows through, but then both the basemap and heatmap layers will be partially faded out:

Overlaying layers with transparency
Overlaying layers by altering transparency – see how both the heatmap and basemap are partially faded

With QGIS 2.0, you’ll be able to use the “multiply” blend mode to overlay these layers. This means both the heatmap and underlying basemap will be shown with full intensity:

Overlaying rasters with multiply
Overlaying rasters with “multiply” blend mode – both layers are shown in their full intensity!

Ok… perhaps that’s not the prettiest example, but it is something I have to do a lot in my job. Until now it’s only been possible by exporting the map to GIMP or Photoshop/Illustrator and setting the blend modes there. That’s always fiddly, time consuming and generally frustrating all round. Much easier to just change it with a dropdown within QGIS itself.

Let’s move on to some more impressive example. First, here’s a terrain map using a combination of a landcover thematic with ‘overlay’ blending and a hillshade set to ‘multiply‘ blending. The graticule lines are also set to overlay – note how they aren’t visible over the lighter water areas and brighter hillshade regions.

Hill shading with advanced compositing
Hill shading with advanced compositing… Hal Shelton would be proud!

Ok, that’s nice, but let’s try something a little different. Using a combination of darkenscreenhard light and overlay:

Stamen-style watercolors directly within QGIS!
Live Stamen-style watercolors within QGIS – sweet!

These a just some rough examples — I’m keen to see what results others get using this feature (feel free to post links to your work in the comments).

One final note: I’m really appreciative of the efforts of the QGIS dev team, who’ve been really supportive and helpful while I find my way around the QGIS codebase. A big thank you has to go to Nathan Woodrow for taking the time to review this commit and answering all the questions I’ve had!

17 thoughts on “Coming soon in QGIS 2.0 – blend modes for layers

  1. Hi.
    I think this is a great feature to add to QGIS. As you said, the opacity settings when overlaying images don’t get the best results.

    I did similar things a couple times (DEM + hillshade + slope) using GDAL and Mapnik, but didn’t get the results I was looking for. Didn’t go a lot further thought, I was just playing around.

    This will be only a visualization tool or it will also allow to export the output as a georeferenced raster ?

    In any case, cheers to everybody working in improving QGIS and OSGEO. I’m trying to work my way there, but I’m still on the basics.

    1. Well, it currently works with maps exported directly as images (these are georeferenced, but not necessarily the full resolution of the input layers) and in exported composer views. While QGIS 2.0 does allow you to save raster layers with symbology at their original resolution I’m pretty sure this only applies to single layers, not compositions of multiple layers. It’s not a bad idea though!

  2. Great Job! I have been dreaming for this feature for a long time in GIS software. I’m glad that it came up in QGIS. Thank you for your hardwork!

  3. Great 🙂

    This will take QGIS 2.0 to next level and I dont see this feature even in commercial products. Hats off ..

  4. I am big fan of Q-GIS . Your team is doing really great work !!! In India in my school (@Pune) QGIS is using for practical session for viewing map and applying colors to map : )

    I am happy with qgis : )

  5. I really get stuck on those nice basemaps in the heatmapimages. You have a stylesheet for those? 🙂

    1. Actually, I can’t take credit for those (although I’d love to)! They’re just a digital copy of the local street directory which has been converted to grayscale. Sorry!

Comments are closed.