I'm trying to semi-automate exporting a layout in ArcGIS Pro using exportToPNG. I have it set up as a Toolbox script so a user enters the folder in manually, then runs the script. So there is a 'arcpy.GetParametersAsText' piece of the script that requires running it in ArcGIS Pro, I think.
The two issues are, first the PNG being exported is not match the layout I am trying to export. The second issue is that none of the map elements are included (north arrow, legend, etc...). Only the map frame appears in the PNG file.
Here is the code:
# Import modules
import arcpy
import datetime
from datetime import datetime
from arcpy import env
arcpy.env.overwriteOutput = True
scriptName = 'DDR2_png_Export.py'
now = datetime.now()
# Set Variables
PNG_name = 'DDR_Map_' + now.strftime("%Y_%m_%d")
PNG_location = arcpy.GetParameterAsText(0)
PNG_export = PNG_location + '/' + PNG_name
aprx = arcpy.mp.ArcGISProject("CURRENT")
map = aprx.listMaps()[0]
map.defaultView.exportToPNG(PNG_export, 6600, 6600, 550, '', '32-BIT_WITH_ALPHA')
# reference - exportToPNG (out_png, width, height, {resolution}, {world_file}, {color_mode}, {embed_color_profile})