ArcGIS Pro 2.8 API Reference Guide
CreatePictureGraphicElement Method (LayoutElementFactory)
Example 

ArcGIS.Desktop.Layouts Namespace > LayoutElementFactory Class : CreatePictureGraphicElement Method
Layout or GroupElement
Envelope
A string that represents the path or URL to the source.
Creates a picture element on a layout from an envelope geometry. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
Public Function CreatePictureGraphicElement( _
   ByVal elementContainer As ILayoutElementContainer, _
   ByVal envelope As Envelope, _
   ByVal url As String _
) As GraphicElement

Parameters

elementContainer
Layout or GroupElement
envelope
Envelope
url
A string that represents the path or URL to the source.

Return Value

Returns a GraphicElement.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
Map has reached maximum graphics count limit of 4000 elements. One or more elements cannot be created.
Map has reached maximum graphics size limit of 10 MB. One or more elements cannot be created.
Remarks
If the element container is a Layout then the element gets added to the root level of the layout TOC at the top most position. If the element container is a GroupElement then it gets added to the group at the topmost position.
Example
//Create a picture element and also set background and border symbology.

//Construct on the worker thread
await QueuedTask.Run(() =>
{
  //Build 2D envelope geometry
  Coordinate2D pic_ll = new Coordinate2D(6, 1);
  Coordinate2D pic_ur = new Coordinate2D(8, 2);
  Envelope env = EnvelopeBuilder.CreateEnvelope(pic_ll, pic_ur);

  //Create and add element to layout
  string picPath = @"C:\Temp\WhitePass.jpg";
  GraphicElement picElm = LayoutElementFactory.Instance.CreatePictureGraphicElement(layout, env, picPath);
  picElm.SetName("New Picture");

  //(Optionally) Modify the border and shadow 
  CIMGraphic picGra = picElm.GetGraphic();
  CIMPictureGraphic cimPicGra = picGra as CIMPictureGraphic;
  cimPicGra.Frame.BorderSymbol = new CIMSymbolReference();
  cimPicGra.Frame.BorderSymbol.Symbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlueRGB, 2.0, SimpleLineStyle.Solid);

  cimPicGra.Frame.ShadowSymbol = new CIMSymbolReference();
  cimPicGra.Frame.ShadowSymbol.Symbol = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.BlackRGB, SimpleFillStyle.Solid);

  //Update the element
  picElm.SetGraphic(picGra);
});
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

LayoutElementFactory Class
LayoutElementFactory Members