Setting default resolution when saving map as image in QGIS

QGIS project offers a quick option for exporting our map as an image. Most sources explain the other way of exporting the maps from QGIS by using the print layout. And rightly so, because the print layout has much more options for customizing our maps and this is surely the most important thing in our process. However how about if you just want to have something printable as quickly as possible?
You can use the shortcut, which is available in Project -> Import/Export – Export map to image or Export map to PDF. The dialog box looks like the one below (Pic. 1).

QGIS Save map as image

Pic. 1 The “Save map as image” option in QGIS.

Everything is fine, we can select the extent, map scale, and so forth. Admittedly, the most important option here is the Resolution, which defines how big is our map regardless of its level of detail. In my point of view, the 120 dpi, which comes as a default results in quite poor quality. The resolution should have been set bigger initially, but it doesn’t and you have to think about it every time! At least by the time you have read this article, which explains to you how to manage this problem once and for all!

First of all let’s have a look at your status bar in QGIS, where you have a few options. One of them is the Magnifier, which always shows 100% as a default enlargement (Pic. 2).

QGIS Status bar magnifier 100%

Pic. 2 The status bar in QGIS with Magnifier set at 100%.

Imagine, that this Magnifier defines the default map resolution in your Import/Export option! Please check the comparisons below for what happens when the Magnifier value is changed (Pic. 3).

QGIS magnifier vs exporrt map as image

Pic. 2 Relation between the value of Magnifier and the default resolution of map exported as the image from the Project -> Import/Export option.

The 100% value of the Magnifier corresponds to the Resolution of 120 dpi. Any changes in the Magnifier will be reflected in changes to the default dpi resolution. And just in the case of 200% the user will get 240dpi and in the case of 300%  – 360dpi accordingly. This is the best way of defining the default resolution for exporting our map as an image. You will never take care of changing the dpi manually. The value of 360dpi or even 240dpi looks well enough to prepare a good map in the .png or .pdf file. Concerning the output let’s see below both approaches, where the first one applies to the changes in the magnifier (Pic. 3,4) and the second one to changes of the Resolution dpi in the Export map as Image box (Pic. 5, 6).

QGIS export map as image gmina WOjaszówka2

QGIS export map as image gmina Wojaszówka

Pic. 4, 5 the comparison of map resolution generated by the “Export map as image” option where the default dpi resolution has been determined by the value of Magnifier in the status bar. The upper image is produced with a default resolution of just 120 dpi and the bottom one with a default resolution of 360 dpi (Magnifier 300%). Click to enlarge.

QGIS export map as image gmina Wojaszówka

QGIS export map as image gmina Wojaszówka 4

Pic. 5, 6 Maps exported as images from the Project -> Import/Export option, where the default dpi resolution was always 120 dpi. It has been changed manually from 120 to 360 dpi later. Click to enlarge.

As you can see, the map on the top (Pic. 3, 5) is visually smaller than the bottom ones (Pic. 4, 6). This is just the aforementioned 120 dpi, which shows a poor resolution. In turn, you even cannot enlarge these maps, because they would be pixelated. Unlike the top map, the bottom ones look much better.

Remember, that this kind of enlargement is just optical. It means, that you won’t have more details visible in your layers. In fact, the map tiles change their level of detail, but your layers don’t. Anyhow this method can accelerate your job slightly if you just need to export a basic map from your QGIS project.

Mariusz Krukar

Forums:

  1. Allow set DPI in “save as image”
  2. https://gis.stackexchange.com/questions/288104/save-map-as-image-in-qgis-3-2

My questions:

  1. https://gis.stackexchange.com/questions/392719/qgis-export-map-as-image-with-fixed-dpi-resolution

Youtube:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *