[QGIS-Developer] outdated cookbook

Jürgen E. Fischer jef at norbit.de
Thu Jul 5 09:17:25 PDT 2018


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

-- 
Jürgen E. Fischer           norBIT GmbH             Tel. +49-4931-918175-31
Dipl.-Inf. (FH)             Rheinstraße 13          Fax. +49-4931-918175-50
Software Engineer           D-26506 Norden             http://www.norbit.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180705/47cf48f0/attachment.sig>


More information about the QGIS-Developer mailing list