I've made an atlas in QGIS where different pages have the same map extent, same dpi, but different page sizes / resolutions. When I export as image (png), however, QGIS overrides the different page sizes with one fixed image size, changing the resolution instead.

Simplified example:

  • Atlas page 1 is 4096x2048 pixels @ 96 dpi, scale 1:2257
  • Atlas page 2 is same extent, 2048x1024 @ 96 dpi, scale 1:4514

If I preview the atlas on screen, it's fine. And I can export page by page using Layout / Export as Image, as expected. But if I try Atlas / Export Atlas as Images, the Image Export options dialog that appears populates with the currently-being-previewed page's dpi and page width and page height, and then all pages are forced to that width and height in pixels. So if I was looking at atlas page 1 on screen, I get 2 exported images at 4096x2048 at different dpi. How do I instead get the dpi to be fixed and the image width and height to change?

The page width and height do change as expected if I export to PDF instead (where the image export options dialog doesn't muck with image size).

I'm doing this to generate pngs at different scale levels that I then convert to one .mbtiles with gdal_translate (plus sqlite3 to combine into a single file). This is to preserve resolution-dependent rendering that creating a single png and then using just gdaladdo would not allow, and to avoid the instability and cross-tile-oundary labeling issues of the QTiles3 plugin.

[QGis Windows 3.6.2]

1 Answer 1


Solved offline. According to PyQGIS documentation, the order of precedence in interpreting layout image export settings is Clip to contents > Specified image size > Specified dpi. Therefore when a specified image size is helpfully calculated (on the basis of the current page) by the options dialog when exporting the atlas as images, that size is implemented for all pages.

The solution is to use the crop to contents setting in the dialog when starting the atlas export, even though this is unnecessary when exporting just one page. When this is selected, QGIS even helpfully changes the image size in the dialog to "Auto".

For example: Atlas > Export Atlas as images... > Save Location > Image Export Options

enter image description here

As an alternative when "clip to contents" would be constraining (as it in turn forces a consistent page margin on each page around the extent of layout items -- in my case fine as 0), exporting the atlas via PyQGIS, as for instance the Maps Printer plugin does, also bypasses this settings clash, since it does not pass an explicit image size unless desired.

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.