How to set image for Picture / IPicture for ArcGIS Desktop?

572
0
01-31-2020 11:44 AM
LaurenPeckman
New Contributor III

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:

```
File pictureFile = new File("myImage.bmp");
Picture pictureDisp = (Picture) pictureFile;
// FAIL: java.io.File cannot be cast to com.esri.arcgis.support.ms.stdole.Picture
```
or
```
Image image = ImageIO.read(getClass().getResource("myImage.bmp"));
Picture pictureDisp = (Picture) image;
// FAIL: java.awt.image.BufferedImage cannot be cast to com.esri.arcgis.support.ms.stdole.Picture
```

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.

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. 

I've also tried creating via BmpPictureElement, with zero success.

http://help.arcgis.com/EN/sdk/10.0/Java_AO_ADF/api/arcobjects/com/esri/arcgis/support/ms/stdole/Pict...

http://resources.esri.com/help/9.3/arcgisengine/java/api/arcobjects/com/esri/arcgis/support/ms/stdol...

http://resources.esri.com/help/9.3/ArcGISEngine/java/api/arcobjects/com/esri/arcgis/carto/BmpPicture...

0 Kudos
0 Replies