Select to view content in your preferred language

Arcpy and saving image as part of document

6220
5
Jump to solution
05-27-2015 01:58 AM
Lars_HolmThomsen
Deactivated User

Hi

On a layout, a logo (jpg-picture) has been inserted as a file-reference and not as a "static" part of the document.

Manually, I can open the mxd and get the properties of the logo-element and then check the checkbox "Save picture as part of the document"

But I have a lot of mxd-files, so...

How can I make this change (saving the picture as part of the document) using ArcPy?

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Ian Murray is right, this property is not exposed to arcpy: PictureElement—Help | ArcGIS for Desktop

In ArcGIS Pro this is no longer a problem:

Pictures are always stored in the project. The sourceImage property displays the original source location during the time the picture was inserted. The file can be removed from disk and the picture will continue to display in the layout.

Source: PictureElement—ArcPy | ArcGIS for Professionals

.. but that doesn't help you...

There is indeed support for this in ArcObjects using IPictureElement::SavePictureInDocument (boolean)

ArcObjects Help for .NET developers

This post by Alexander Nohe  has instructions on how to use ArcObjects in Python if that's what you would like:

Create a new MXD through Python.

View solution in original post

5 Replies
Lars_HolmThomsen
Deactivated User

Is this not possible? Anyone?

0 Kudos
IanMurray
Honored Contributor

I'm not sure arcpy does not have a functionality to embed images into map documents from what I've seen.  It may be possible with ArcObjects, but the current arcpy methods and functions do not allow for that.  Likewise, if you have a picture element that is saved as part of the document, it no longer has a name with ListLayoutElements and its source is unable to be changed. 

Apparently this issue came up on the old forums, but was never adequately addressed by anyone.

Sources checked:

Paul Zandbergen Python Scripting for ArcGIS

ArcGIS Help -arcpy mapping module - Picture Elements Methods

General Web Search

GIS Stack Exchange

XanderBakker
Esri Esteemed Contributor

Ian Murray is right, this property is not exposed to arcpy: PictureElement—Help | ArcGIS for Desktop

In ArcGIS Pro this is no longer a problem:

Pictures are always stored in the project. The sourceImage property displays the original source location during the time the picture was inserted. The file can be removed from disk and the picture will continue to display in the layout.

Source: PictureElement—ArcPy | ArcGIS for Professionals

.. but that doesn't help you...

There is indeed support for this in ArcObjects using IPictureElement::SavePictureInDocument (boolean)

ArcObjects Help for .NET developers

This post by Alexander Nohe  has instructions on how to use ArcObjects in Python if that's what you would like:

Create a new MXD through Python.

Lars_HolmThomsen
Deactivated User

Thanx Xander and Ian - you gave me the answers I needed!

Hi from Lars

0 Kudos
XanderBakker
Esri Esteemed Contributor

I'm glad that we could help. Could you mark the question as answered?

Mark a reply as the Correct Answer

0 Kudos