[Qgis-user] how to invoke the save as image from the python console
Martin Dobias
wonder.sk at gmail.com
Fri Oct 7 09:13:26 PDT 2011
On Fri, Oct 7, 2011 at 12:05 PM, Rhys A.D. Stewart
<rhys.stewart at gmail.com> wrote:
> Greetings,
>
> hoping for a quick answer before i go diving through the API. is there
> a quick way to invoke the save as image dialogue from the console? o
> have a list of coordinates and would like to zoom in and get an image
> of each area around the coords? But since i have about 250 or so
> coords am not too keen on doing it manually.......so then i really
> dont want the save as image box to come up really i want the
> functionality from the console.
You can directly use QgsMapRenderer class to render the map to
whatever target - in your case it would be a QImage that you can save
to a file. PyQGIS cookbook gives an example how to construct and use
map renderer. If you are going to use map canvas contents you may take
advantage of map renderer from map canvas (
qgis.utils.iface.mapCanvas().mapRenderer() ) and only change extents
and trigger the rendering.
[1] http://www.qgis.org/pyqgis-cookbook/composer.html
Martin
More information about the Qgis-user
mailing list