Related to the second portion of my question regarding getting an image of
the rendered canvas extent as an output i've tried to implement the
following as modified from the pyqgis handbook

from qgis.core import *
from qgis.gui import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtXml import *

output = r'C:\output.png'

mc = iface.mapCanvas()
rect = mc.extent()
img = QImage(QSize(800,600), QImage.Format_ARGB32_Premultiplied)
color = QColor(255,255,255)
img.fill(color.rgb())
p = QPainter()
p.begin(img)
p.setRenderHint(QPainter.Antialiasing)
render = QgsMapRenderer()
render.setExtent(rect)
render.setOutputSize(img.size(), img.logicalDpiX())
render.render(p)
p.end()
img.save(output,"png")

however the resulting image that I receive is simply a blank white image
(from the im.fill step) in addition im not entirely sure how the size of the
QImage can be related to the current extent rect? 

Again any help would be appreciated,
Cheers,
Bjorn



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Map-Canvas-Current-Zoomed-Extent-tp5097678p5097818.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to