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

01-31-2020 11:44 AM
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: cannot be cast to
Image image ="myImage.bmp"));
Picture pictureDisp = (Picture) image;
// FAIL: java.awt.image.BufferedImage cannot be cast to

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.

0 Kudos
0 Replies