Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to get pixel size of canvas in QGIS? It is possibly by python?example

I mean this read rectangle area.

share|improve this question
what do you mean with dataframe? If you mean a raster-layer than the pixelsize is in the properties – Curlew Mar 20 '13 at 20:33
up vote 4 down vote accepted

You can get those values with this code :


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()))
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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