4

I'm making a complement for QGIS3, how can I export the map I'm seeing in the window to .PNG using Plugin Builder. Without having to go through Print Composers.

enter image description here

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
Seba79
  • 177
  • 1
  • 5
  • Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our [faq]. – underdark Aug 02 '18 at 17:49

2 Answers2

7

I assume you know how to create a plugin by Plugin Builder 3. If so, briefly, delete the code lines under def run(self): line in main file of your plugin and just add the following code under def run(self): line.

self.iface.mapCanvas().saveAsImage("your_path/file_name.png")

If you don't know how to create a plugin by Plugin Builder 3, firstly please refer to Qgis Plugin Builder page.

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
4

Assuming QGIS 3.x.

Project> Import/Export> Export Map to Image...

HeikkiVesanto
  • 16,433
  • 2
  • 46
  • 68