I am using the QGIS temporal controller and trying to output images with a transparent background. (I plan to insert a custom background image created outside of QGIS into the final video.) The things I've tried so far are:

  • The QGIS Print Composer allows you to set a transparent background, but that isn't the temporal controller

  • It doesn't appear that you can set the map canvas background to transparent via the rgba(r,g,b,a) or #RRGGBBAA values in the project properties settings. When I add an alpha value, it reverts to #ffffff enter image description here

  • There is this python script to set the actual map canvas transparent for an output image. I could not get this to work, however, and am unsure if it can be linked to the temporal controller image output dialogue.

  • A workaround is to remove white from all .png images output from the temporal controller with ffmpeg prior to creating the final animation video, but this creates nasty white edges from the anti aliasing around the non-white pixels

     for f in *.png; do ffmpeg -hide_banner -loglevel error -i $f -vf colorkey=white:0.1:0.0 trans_${f}; done;

Any ideas on how to set the QGIS map canvas to transparent?

  • Not sure if its possible. Maybe you can use a custom defined background color and than batch replace it in a graphic software?
    – Babel
    Jan 19, 2023 at 22:00
  • @Babel yes, this works with the ffmpeg option shown above, it just makes the final images a little 'dirty' because of the anti-aliasing.
    – jamierob
    Jan 19, 2023 at 22:46

1 Answer 1


Maybe this approach can work for you, with a bit of extra work, making use of Layouts and Atlas.

In Layouts, you can set the page Background to transparent, and uncheck the Background tick of your Map item. This will display the main map layer with a fully transparent background.

Now we need to generate the animation based on Layouts.

For that I created a layer called 'Animation', with no Geometry, and a 'date' field, corresponding to each individual date you will want to animate. This layer will be used as a source for the Atlas.

In the Layouts, select that layer as an Atlas and set the page name to that "date" field, this will carry the wanted date items to the @atlas_pagename variable:

enter image description here

Then in the Layer Symbology, instead of using the @map_startime variable for the animation, you can use to_datetime(@atlas_pagename) variable.

Here I have a simple marker size depending on the animation datetime: enter image description here

The Temporal Controller is not used anymore, frames can be seen updating in both the Layout / main interface when you go through the different Atlas pages.

Export from the Atlas are transparent .png, where you can add whatever background:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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