I'm trying to write a python script that will add a tif to the table of contents of my map.

(Eventually I want to convert to tool that

  1. allows the user to type in the filename and then has the tool create the full path name, and
  2. zooms to the extent of the newly-added tif, but baby-steps for now.)

My first stumbling block is a very basic one, seemingly.

I'm trying to add tifs, not layers, to my TOC. Do I need to use MakeFeatureLayer(), before I can use AddLayer() ?


1 Answer 1


You can technically point right to the image file using add layer method, see code below:

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
addLayer = arcpy.mapping.Layer(r"C:\Temp\image.tif")
arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")

If you want to load the image with a certain saved color scheme you can point the add layer method to a .lyr file instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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