Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "F:/QGIS/bin/test.py", line 6, in <module>
    img = QImage(QSize(800,600), QImage.Format_ARGB32_Premultiplied)
NameError: name 'QImage' is not defined

I encountered this error when I was trying for Map Rendering and Printing on python console given in QGIS.

closed as unclear what you're asking by blah238, Jason Scheirer, BradHards, radouxju, PolyGeo Mar 6 '14 at 8:32

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    missing import? Can you show a more complete example that demonstrates the problem so we don't have to guess? – BradHards Mar 5 '14 at 19:59

QImage is in QtGui, so my first thought would be that you need to import PyQt4.QtGui.

So either:

from PyQt4.QtGui import *


import PyQt4.QtGui

But more information would be helpful if importing PyQt4.QtGui doesn't get rid of the error.

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