<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Use embedded image as GraphicElement on Layout in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/use-embedded-image-as-graphicelement-on-layout/m-p/1002031#M5746</link>
    <description>&lt;P&gt;I am trying to add a number of PNG images to a Layout as GraphicElements, but I want to use images I've saved as embedded resources. All the examples I've seen use an absolute file path to the user's directory.&amp;nbsp; I'd like the GraphicElement to pull the image file from the add-in, not the user's machine.&amp;nbsp; My solution works perfectly when I use an absolute file path to my own machine - &lt;EM&gt;how do I modify the code to pull the embedded image resource instead?&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Note - the embedded image is listed as "resource" and "do not copy", although I've tried many combinations.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//  Hardcoding the path (for now)
string picPath = @"C:\User\ABC123\CompanyLogo.png";  //This works
string picPath = "pack://application:,,,/LayoutToolAddin;component/Images/CompanyLogo.png";  // Does NOT work.
GraphicElement picElm = LayoutElementFactory.Instance.CreatePictureGraphicElement(newLayout, env_logo, picPath);
picElm.SetName("Company_Logo");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Resources I've checked:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-content-and-image-resources#images-as-embedded-resources" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-content-and-image-resources#images-as-embedded-resources&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-show-costum-images-in-arcgis-pro-notification/m-p/796825#M1814" target="_blank"&gt;https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-show-costum-images-in-arcgis-pro-notification/m-p/796825#M1814&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;My apologies if I've missed something obvious.&amp;nbsp; This is the first time I've ever worked in C#.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Nov 2020 03:45:35 GMT</pubDate>
    <dc:creator>GregC</dc:creator>
    <dc:date>2020-11-17T03:45:35Z</dc:date>
    <item>
      <title>Use embedded image as GraphicElement on Layout</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/use-embedded-image-as-graphicelement-on-layout/m-p/1002031#M5746</link>
      <description>&lt;P&gt;I am trying to add a number of PNG images to a Layout as GraphicElements, but I want to use images I've saved as embedded resources. All the examples I've seen use an absolute file path to the user's directory.&amp;nbsp; I'd like the GraphicElement to pull the image file from the add-in, not the user's machine.&amp;nbsp; My solution works perfectly when I use an absolute file path to my own machine - &lt;EM&gt;how do I modify the code to pull the embedded image resource instead?&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Note - the embedded image is listed as "resource" and "do not copy", although I've tried many combinations.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//  Hardcoding the path (for now)
string picPath = @"C:\User\ABC123\CompanyLogo.png";  //This works
string picPath = "pack://application:,,,/LayoutToolAddin;component/Images/CompanyLogo.png";  // Does NOT work.
GraphicElement picElm = LayoutElementFactory.Instance.CreatePictureGraphicElement(newLayout, env_logo, picPath);
picElm.SetName("Company_Logo");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Resources I've checked:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-content-and-image-resources#images-as-embedded-resources" target="_blank"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-content-and-image-resources#images-as-embedded-resources&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-show-costum-images-in-arcgis-pro-notification/m-p/796825#M1814" target="_blank"&gt;https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-show-costum-images-in-arcgis-pro-notification/m-p/796825#M1814&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;My apologies if I've missed something obvious.&amp;nbsp; This is the first time I've ever worked in C#.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 03:45:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/use-embedded-image-as-graphicelement-on-layout/m-p/1002031#M5746</guid>
      <dc:creator>GregC</dc:creator>
      <dc:date>2020-11-17T03:45:35Z</dc:date>
    </item>
  </channel>
</rss>

