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).
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).
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).
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).
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:
- Allow set DPI in “save as image”
- https://gis.stackexchange.com/questions/288104/save-map-as-image-in-qgis-3-2
My questions:
Youtube: