SHARE
TWEET

Untitled

a guest Mar 20th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Run in QGIS
  2. # Save all the layouts as PNG files from the current project.
  3. outurl = '/Users/USERNAME/' # using ~ does not work?
  4. outformat = '.png'
  5. outdpi = 200
  6. manager = QgsProject.instance().layoutManager()
  7. for layout in manager.printLayouts():
  8.     print('Saving: ' + layout.name())
  9.    
  10.     layout = manager.layoutByName(layout.name())
  11.     exporter = QgsLayoutExporter(layout)
  12.  
  13.     legendExporter=QgsLayoutExporter(layout)
  14.     imageSettings=legendExporter.ImageExportSettings()
  15.     imageSettings.cropToContents=True
  16.     imageSettings.dpi=outdpi
  17.  
  18.     legendExporter.exportToImage(outurl + layout.name() + outformat,imageSettings)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top