Hello!
Some time ago, I inserted a transparent image in the layout to use as a background for the caption. After inserting it in the layout I adjusted it to the desired size (rectangular).
I recently moved the image to another folder and renamed it. Of course I forgot the detail of the path in the layouts!
To repair the broken path I used the code (below, available at https://desktop.arcgis.com). However, when I open the project, the image is in another size (square).
Is there any way to avoid this and preserve the size?
Thanks!
Code sample
PictureElement example 1
The following script will find an image by name and set its data source to a new location.
<SPAN>import</SPAN> <SPAN>arcpy</SPAN><SPAN>mxd</SPAN> <SPAN>=</SPAN> <SPAN>arcpy</SPAN><SPAN>.</SPAN><SPAN>mapping</SPAN><SPAN>.</SPAN><SPAN>MapDocument</SPAN><SPAN>(</SPAN><SPAN>r"C:\Project\Project.mxd"</SPAN><SPAN>)</SPAN><SPAN>for</SPAN> <SPAN>elm</SPAN> <SPAN>in</SPAN> <SPAN>arcpy</SPAN><SPAN>.</SPAN><SPAN>mapping</SPAN><SPAN>.</SPAN><SPAN>ListLayoutElements</SPAN><SPAN>(</SPAN><SPAN>mxd</SPAN><SPAN>,</SPAN> <SPAN>"PICTURE_ELEMENT"</SPAN><SPAN>):</SPAN> <SPAN>if</SPAN> <SPAN>elm</SPAN><SPAN>.</SPAN><SPAN>name</SPAN> <SPAN>==</SPAN> <SPAN>"Photo"</SPAN><SPAN>:</SPAN> <SPAN>elm</SPAN><SPAN>.</SPAN><SPAN>sourceImage</SPAN> <SPAN>=</SPAN> <SPAN>r"C:\Project\Data\NewPhoto.bmp"</SPAN><SPAN>mxd</SPAN><SPAN>.</SPAN><SPAN>save</SPAN><SPAN>()</SPAN><SPAN>del</SPAN> <SPAN>mxd</SPAN>