In this article you will learn how to export the Data Driven Page generated in an ArcMap file to an image file (JPG, JPEG, PNG, TIFF, GIF, among others) using Python. Of all the existing image formats you will learn how to do it to PNG format as it has an optimal balance between file size and image quality, but with slight modifications you can get as a result images in any file format. No programming required.
Normally you can export Data Driven Page to PDF format as follows:
Cómo exportar mapas a PDF con Data Driven Pages de ArcGIS
1) Open the MXD file with the Data Driven Page enabled.
2) Go to File.
3) Click on “Export Map...” in the submenu that appears.
4) In the Pages tab indicate the pages to be exported (a) and whether to save in a single PDF file or in several files (b).
5) In the General tab choose the File name (a), the file type (b) and the resolution (c). Then press the “Save” button (d).
However, there is no way to export more than one page at a time to image files from the “Export Map...” menu, and one option you would have would be to convert the PDF files to images with any program that allows conversion or web page, but you would have to resort to an external tool and you could lose image resolution in the process, for this reason I will show you how it can be much more efficient using Python codes (Do not worry you do not need to know how to program to do it).
How to export Data Driven Pages views to PNG?
Step 1: Open the MXD file with the Data Driven Page enabled.
Step 2: Open the Python window in the Standard toolbar.
Step 3: Copy into a note blog the following code and replace the text C:\EJEMPLO in line #09 with the path to the folder where you want the images to be saved.
Step 4: In line #10 of the code replace the word PREFIX with the prefix you want for the images.
Step 5: On line #08 replace the word “PageNumber” with the name of the field used to name the pages of the Data Driven Page.
Step 6: Copy the modified code into the Python window and press the Enter key twice.
After a few seconds you will see the images start to appear in PNG format in the output folder indicated in step 3 and in this way you can export the pages generated by the Data Driven Page from an MXD file to images.
Notes:
- In line 11 you can change the dpi at which the images are exported, currently it is set to 1000 dpi, which in my experience is the best resolution for image files to be used in documents. The export time is directly proportional to the number of dpi.
- In line 11 you can modify the type of image file you want, replacing the text ExportToPNG by any of the following options ExportToBMP, ExportToEMF, ExportToEPS, ExportToGIF, ExportToJPEG, ExportToSVG, ExportToTIFF; it is also necessary to modify in line 11 the text .png by the desired output format (.bmp, .emf, .eps, .gif, .jpg, .svg, .tif).
I hope you enjoyed this article, soon I will upload a video explaining the procedure that you will be able to consult in this blog. Save my blog among your favorite links, I will be uploading many more tricks of this style, remember that you can send me your concerns in the contact page or leave your comment, I will be attentive to respond.





