I need my map canvas to be exactly 1920x1080. So the Save as image would save a png exactly this size. I've tried setting it with


But no luck, resize() seems to be deprecated. I'm using QGIS 2.16.0.

I'd also like to set map extent programmatically, if that's related. Unfortunately, using composer is not an option here.

  • I find the saved image is 2 pixels smaller in height and width than the size set with .resize() - QGIS 2.14 (maybe fixed in 2.16?).
    – Spacedman
    Sep 2 '16 at 9:28

You can use the following to resize the map canvas:

from PyQt4.QtCore import QSize

You need to import QSize before being able to use it. Although you seem to be correct in that it was depreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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