5

Picture element, in 60 MXD files, disappear and there only blanked rectangle instead. enter image description here

I know one way to solved it, by go to the picture properties-->picture tab.

But i try to find a way do it with arcpy. Is it possible?

1 Answer 1

5

Sounds like you just want to change the source of the image. You need to use ListLayoutElements on your MXD. From the help:

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
for elm in arcpy.mapping.ListLayoutElements(mxd,"PICTURE_ELEMENT", "*logo*"):
    if elm.name == "CityLogo":
        elm.sourceImage = r"C:\Project\Data\Photo.bmp"
mxd.saveACopy(r"C:\Project\Project2.mxd")
del mxd
1
  • Chad, this code worked only when i delete "logo" in the parenthesis- why is it?
    – newGIS
    Commented Feb 15, 2016 at 7:24

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.