I'm exporting a map to a PNG file in QGIS 3.10.4 via Project > Import/Export > Export Map to Image. In the dialog that shows up, I can select the extent (exported area), scale, resolution (DPI), and image size (in pixels). Obviously those are related, and changing them completely independently is not possible. QGIS automatically propagates changes made for one quantity to others so that the values stay consistent:

  • If I change the extent, the image size is adjusted
  • If I change the scale, the extent is adjusted
  • If I change the resolution, the image size is adjusted
  • If I change the image size, the extent is adjusted

My goal is to create an export with a given extent, scale, and resolution (and the image size necessary to achieve that). Given the automatism described above, that's rather cumbersome to achieve: I'd like to take the extent of a given layer (the dialog includes an option for that), but this automatically sets the scale to that of the current view (I think?). When I then set the scale to my desired value, this automatically changes the extent.

My current workaround is to first set the extent to that of the desired layer, writing down the values, setting the scale, and then re-entering the desired extent. Surely there must be an easier way?

1 Answer 1


The short answer

You can solve your problem with two basic tricks:

  1. Create a Print layout

  2. Set a fixed value for scale with data driven override.

In more details:

You can create a new Print layout where you put your map, set extent and scale. When exporting that to an image file, you choose the resolution. The size in pixels will adapt automatically.

The trick is to use data driven override for the scale. Than it will be constant and will not change any more. Just click the small icon to the right of the scale and insert there a fixed value.

A step by step guide with screenshots

Let's say you have a map of Switzerland and want to have the min/max extent of the polygon layer covering Switzerland. The map should be in a scale of 1:3.000.000. First, set up your map in the print layout and scale to 3 mio. The extent is not yet as desired:

enter image description here

If you now change the extent manually, you get the correct extent, but the scale changes, as you describe it:

enter image description here

So first set the data driven override for the scale to 3.000.000. This will remain fixed, even when you change the extent of the map and the frame of the map (using the symbol in the toolbar at the left or setting the values in the element properties).

enter image description here

You now probably want to limit the page size to the map only, at least in case you don't add other elements to the layout like legend, text, tables etc. To "clip" the white space around the map itself, go to tab Layout / Resize Layout to Content / Resize layout and click it:

enter image description here

If you now export the image, you can set the resolution/image size:

enter image description here

  • This doesn't seem to work for me: I've added a map, but when I try to adjust its scale or extent on the Item Properties tab they auto-adjust, so that I can only really tune either one of them. Is there something I'm missing? Jan 16, 2021 at 17:42
  • I don't think that this is something that depends on the actual map. As I wrote in my original post I am able to get the results that I want, it's just that the workflow seems unnecessarily cumbersome. Jan 16, 2021 at 19:22
  • Updated my answer - does it help?
    – Babel
    Jan 16, 2021 at 20:21

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.