How to get pixel size of canvas in QGIS? It is possibly by Python. I mean this red rectangle area in the image.
1 Answer
You can get those values with this code :
qgis.utils.iface.mapCanvas().size()
This returns a QSize
object. You can catch width and height directly with
canvasSize = qgis.utils.iface.mapCanvas().size()
print("Width : " + str(canvasSize.width()) + " / Height : " + str(canvasSize.height()))