I am struggling with ESRI's Picture / IPicture Java documentation for ArcObjects 10.4.

I just need to grab the image file from my project's source (src) folder, and cast that as a Picture. Here's 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


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 ArcObjects Java.

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.

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




  • 2
    There is no such product as "ArcDesktop". There is a product known as "ArcGIS Desktop", but it includes both ArcMap/ArcCatalog/... and ArcGIS Pro. Your documentation links are all from ArcObjects for Java (albeit long retired versions thereof). Do you mean that you are working with the "ArcObjects Java SDK"?
    – Vince
    Commented Jan 31, 2020 at 18:59

1 Answer 1


In C# I use something like this:

System.Drawing.Bitmap dotNetBmp = new System.Drawing.Bitmap(@"C:\Temp\MyBitmap.bmp");     
stdole.IPictureDisp pict = ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromBitmap(dotNetBmp );

Maybe it's in Java similar.

  • Alas. Of the 2 examples and 3 links in the question, plus many other fruitless searches, I couldn't find a functioning java equivalent. Always possible that I missed it, of course.
    – lep
    Commented Feb 25, 2020 at 20:19
  • In C#, the current info is: error CS0618 'OLE' is obsolete: The assembly containing this class is obsolete. Reference the ESRI.ArcGIS.ADF.Local assembly instead. What would that look like? I can't seem to figure out how to reference local assembly.
    – lep
    Commented Mar 16, 2023 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.