[GIS] Arcpy: Exporting PNGs with high quality using data driven pages

arcpydata-driven-pages

I am using data driven pages and want to automatically export my layouts/extents to PNG. Since you have to use arcpy to export to PNG with data driven pages, I used following code, as explained here: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00sm00000008000000

mxd = arcpy.mapping.MapDocument("CURRENT")
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
    mxd.dataDrivenPages.currentPageID = pageNum
    arcpy.mapping.ExportToPNG(mxd, r"C:\Temp\ParcelAtlas_Page" +str(pageNum) + ".png")
del mxd

The problem is that the quality is very bad when I export like this. If I export to PNG manually, and set for example 300 dpi, it is way better than exporting automatically.

Would you know a solution to export in better quality using arcpy and data driven pages in ArcMap?

Best Answer

The output resolution of the ExportToPNG tool is 96 dpi by default, but you can modify it, see the help page of the tool.

arcpy.mapping.ExportToPNG(mxd, r"C:\Temp\ParcelAtlas_Page" +str(pageNum) + ".png", resolution=300)
Related Question