Skip to content

Instantly share code, notes, and snippets.

@gavinr
Created July 8, 2020 17:37
Show Gist options
  • Save gavinr/bad230cfbe4894e507864b2e1a6a9afa to your computer and use it in GitHub Desktop.
Save gavinr/bad230cfbe4894e507864b2e1a6a9afa to your computer and use it in GitHub Desktop.
Export an image (JPG) from an ArcGIS Pro project
# First create an ArcGIS Pro Project, with at least one template, and put the
# name of it below.
import arcpy
TEMPLATE_NAME = "Square"
aprx = arcpy.mp.ArcGISProject("basic.aprx")
for lyt in aprx.listLayouts():
if lyt.name == TEMPLATE_NAME:
# export!
print(f" {lyt.name} ({lyt.pageHeight} x {lyt.pageWidth} {lyt.pageUnits})")
lyt.exportToJPEG("out.jpg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment