AnsweredAssumed Answered

How to prevent the image changing its dimension in the layout?

Question asked by amonizm on Feb 19, 2020

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.

import arcpymxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")for elm in arcpy.mapping.ListLayoutElements(mxd, "PICTURE_ELEMENT"):    if elm.name == "Photo":        elm.sourceImage = r"C:\Project\Data\NewPhoto.bmp"mxd.save()del mxd

Outcomes