Thanks Jurgen!

That kind of works for my current problem (though it seems hard to loop this function and export different maps after updating the mapcanvas).

Still I would like to fix this in the cookbook using the QgsMapRenderer(Sequential)Job in the right way. So if anyone could post a working example??

Thanks!
Raymond



On 05-07-18 18:17, Jürgen E. Fischer wrote:
Hi Raymond,

On Thu, 05. Jul 2018 at 16:53:21 +0200, Raymond Nijssen wrote:
Can anyone provide a working example for exporting maps to png files?

Probably not a nice example for the cookbook, but this does the job and even
works alike on 2 and 3 (essentially what QgisApp::saveAsImage does):

c = iface.mapCanvas()
pm = QPixmap(c.width(), c.height())
c.saveAsImage("/tmp/foo.png", pm)


Jürgen


_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to