Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I cannot get ArcMap 10.0 or 10.1 to "Export Map" to a png or gif with a transparent background -- no matter what I set the background and transparent colors to. Thus, I created the following script, which does the trick, but I'd rather be able to get the default tool in ArcMap to do it. Any better ideas?

# Purpose: This script exports an MXD view to a png file with transparent background,
# which is problematic to do manually due to a Windows-related bug in the ArcMap UI.
# Warning: It will make any white features (e.g. the default background color) transparent.
# When in ArcMap, viewing a saved mxd...
# 1. From the Geoprocessing menu, select 'Python'.
# 2. In the new Python window, right-click somewhere after >>>, and select 'Load...'
# 3. Select this script.
# 4. When this script appears, press Enter twice to run it.
# 5. A new [mxd-name].png with transparent background will appear in the same directory as the mxd.
# 6. When finished/satisfied, close the Python window.
# http://forums.arcgis.com/threads/65463-Zoom-to-tile-and-Export-to-JPEG-with-World-File
import arcpy
png_resolution = 300    # Can adjust DPI
# Set mxd and png name
mxd = arcpy.mapping.MapDocument("CURRENT")
pngname = mxd.filePath.replace(".mxd",".png")
df = arcpy.mapping.ListDataFrames(mxd)[0]
# Calculate ideal image size from the mxd view and desired DPI
png_width = int((df.extent.XMax - df.extent.XMin) * png_res * 12 / df.scale)
png_height = int((df.extent.YMax - df.extent.YMin) * png_res * 12 / df.scale)
#Export PNG
print "Exporting: {0}\n{1} x {2} pixels, {3}-dpi".format(pngname,png_width,png_height,png_res)
arcpy.mapping.ExportToPNG(mxd, pngname, df, df_export_width = png_width, df_export_height = png_height, resolution = png_res, transparent_color = "255, 255, 255")
#Clean up
del df, pngname, png_res, png_width, png_height, mxd
share|improve this question

1 Answer 1

up vote 3 down vote accepted

I just gave this a test using ArcGIS for Desktop 10.2 on Windows 7 SP1 and was able to create a PNG and GIF files that had a transparent background that I could verify by inserting them as pictures into Word 2010 as In Front Of Text.

I followed the Exporting your map instructions from the ArcGIS 10.1 Online Help, using Rose Quartz as both Background and Transparent Color, doing so from both Data and Layout View, and otherwise taking all defaults.

PNG and GIF support transparency. They have a Transparent Color option, which selects the color in the map that will be marked as transparent. If you want to make only the background of the map image transparent, set Background Color and Transparent Color to the same color.

If at all possible, I would recommend upgrading to ArcGIS for Desktop 10.2 (or testing this on another machine with that version to decide whether you want to).

share|improve this answer
I didn't try any other color than white, but I tried all combinations of the background and transpancy colors (in white) and this problem exists on at least 3 machines in our network, one running v.10.0 and 2 with v.10.1. I suppose I can try a different color, but having to select another color is definitely a kludge. I don't know when our techs will OK the move to 10.2. Guess we'll see. –  ksed Sep 19 '13 at 22:42
I don't think the color is important because I just retested using white (Arctic White on color palette) and that seemed fine too. –  PolyGeo Sep 19 '13 at 23:40
Update: Using rose quartz didn't help. I guess we'll have to wait for 10.2. –  ksed Sep 20 '13 at 12:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.