<?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 How to set image for Picture / IPicture for ArcGIS Desktop? in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/how-to-set-image-for-picture-ipicture-for-arcgis/m-p/764061#M5187</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;"&gt;&lt;SPAN style="color: #242729; background-color: #f9f8f6;"&gt;I am struggling with ESRI's Picture / IPicture java arcobjects documentation for ArcGIS Desktop (not Runtime). I just need to grab the image file from my project's source (src) folder, and cast that as a Picture. Here's a little of what I've tried:&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;"&gt;&lt;SPAN style="color: #242729; background-color: #f9f8f6;"&gt;```&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;File pictureFile = new File("myImage.bmp");&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;Picture pictureDisp = (Picture) pictureFile;&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;// FAIL: java.io.File cannot be cast to com.esri.arcgis.support.ms.stdole.Picture&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;```&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;or &lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;```&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;Image image = ImageIO.read(getClass().getResource("myImage.bmp"));&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;Picture pictureDisp = (Picture) image;&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;// FAIL: java.awt.image.BufferedImage cannot be cast to com.esri.arcgis.support.ms.stdole.Picture&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;```&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;"&gt;&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;I've tried the above scenarios with IPicture as well. I have no idea by what process on can set the Picture (or IPicture) in Java for ArcDesktop.&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;I can't use a file path, this project will be deployed as an add-in, and not all users will have access to the same file paths. I need the file embedded in my program. I just want my image file to be accessible via Picture or IPicture... or sure, BmpPictureElement. Why not! But I can't seem to access it, no matter what I try.&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;I've also tried creating via BmpPictureElement, with zero success.&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;&lt;A href="http://help.arcgis.com/EN/sdk/10.0/Java_AO_ADF/api/arcobjects/com/esri/arcgis/support/ms/stdole/Picture.html" rel="nofollow noreferrer" style="color: #1d4d5c; border: 0px; font-weight: inherit; text-decoration: underline;"&gt;http://help.arcgis.com/EN/sdk/10.0/Java_AO_ADF/api/arcobjects/com/esri/arcgis/support/ms/stdole/Picture.html&lt;/A&gt;&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;&lt;A href="http://resources.esri.com/help/9.3/arcgisengine/java/api/arcobjects/com/esri/arcgis/support/ms/stdole/IPicture.html#selectPicture(int,%20int[],%20int[])" rel="nofollow noreferrer" style="color: #1d4d5c; border: 0px; font-weight: inherit; text-decoration: underline;"&gt;http://resources.esri.com/help/9.3/arcgisengine/java/api/arcobjects/com/esri/arcgis/support/ms/stdole/IPicture.html#selectPicture(int,%20int[],%20int[])&lt;/A&gt;&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;&lt;A href="http://resources.esri.com/help/9.3/ArcGISEngine/java/api/arcobjects/com/esri/arcgis/carto/BmpPictureElement.html" rel="nofollow noreferrer" style="color: #1d4d5c; border: 0px; font-weight: inherit; text-decoration: underline;"&gt;http://resources.esri.com/help/9.3/ArcGISEngine/java/api/arcobjects/com/esri/arcgis/carto/BmpPictureElement.html&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 Jan 2020 19:44:10 GMT</pubDate>
    <dc:creator>LaurenPeckman</dc:creator>
    <dc:date>2020-01-31T19:44:10Z</dc:date>
    <item>
      <title>How to set image for Picture / IPicture for ArcGIS Desktop?</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-set-image-for-picture-ipicture-for-arcgis/m-p/764061#M5187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;"&gt;&lt;SPAN style="color: #242729; background-color: #f9f8f6;"&gt;I am struggling with ESRI's Picture / IPicture java arcobjects documentation for ArcGIS Desktop (not Runtime). I just need to grab the image file from my project's source (src) folder, and cast that as a Picture. Here's a little of what I've tried:&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;"&gt;&lt;SPAN style="color: #242729; background-color: #f9f8f6;"&gt;```&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;File pictureFile = new File("myImage.bmp");&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;Picture pictureDisp = (Picture) pictureFile;&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;// FAIL: java.io.File cannot be cast to com.esri.arcgis.support.ms.stdole.Picture&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;```&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;or &lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;```&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;Image image = ImageIO.read(getClass().getResource("myImage.bmp"));&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;Picture pictureDisp = (Picture) image;&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;// FAIL: java.awt.image.BufferedImage cannot be cast to com.esri.arcgis.support.ms.stdole.Picture&lt;BR style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;" /&gt;```&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="null;/*startdm*/background-color: rgba(0, 0, 0, 0) !important;"&gt;&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;I've tried the above scenarios with IPicture as well. I have no idea by what process on can set the Picture (or IPicture) in Java for ArcDesktop.&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;I can't use a file path, this project will be deployed as an add-in, and not all users will have access to the same file paths. I need the file embedded in my program. I just want my image file to be accessible via Picture or IPicture... or sure, BmpPictureElement. Why not! But I can't seem to access it, no matter what I try.&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;I've also tried creating via BmpPictureElement, with zero success.&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;&lt;A href="http://help.arcgis.com/EN/sdk/10.0/Java_AO_ADF/api/arcobjects/com/esri/arcgis/support/ms/stdole/Picture.html" rel="nofollow noreferrer" style="color: #1d4d5c; border: 0px; font-weight: inherit; text-decoration: underline;"&gt;http://help.arcgis.com/EN/sdk/10.0/Java_AO_ADF/api/arcobjects/com/esri/arcgis/support/ms/stdole/Picture.html&lt;/A&gt;&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;&lt;A href="http://resources.esri.com/help/9.3/arcgisengine/java/api/arcobjects/com/esri/arcgis/support/ms/stdole/IPicture.html#selectPicture(int,%20int[],%20int[])" rel="nofollow noreferrer" style="color: #1d4d5c; border: 0px; font-weight: inherit; text-decoration: underline;"&gt;http://resources.esri.com/help/9.3/arcgisengine/java/api/arcobjects/com/esri/arcgis/support/ms/stdole/IPicture.html#selectPicture(int,%20int[],%20int[])&lt;/A&gt;&lt;/P&gt;&lt;P style="border: 0px; margin: 0px 0px 1em;"&gt;&lt;A href="http://resources.esri.com/help/9.3/ArcGISEngine/java/api/arcobjects/com/esri/arcgis/carto/BmpPictureElement.html" rel="nofollow noreferrer" style="color: #1d4d5c; border: 0px; font-weight: inherit; text-decoration: underline;"&gt;http://resources.esri.com/help/9.3/ArcGISEngine/java/api/arcobjects/com/esri/arcgis/carto/BmpPictureElement.html&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jan 2020 19:44:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-set-image-for-picture-ipicture-for-arcgis/m-p/764061#M5187</guid>
      <dc:creator>LaurenPeckman</dc:creator>
      <dc:date>2020-01-31T19:44:10Z</dc:date>
    </item>
  </channel>
</rss>

