Help with pragmatically setting an IImageShape

Hi guys, I’m having some trouble programatically seeing an IImageShape image.

Originally I tried following this guide but it did not work and would not allow me to set images manually afterwards.

Create Diagram Image Shape with API - Visual Paradigm Know-how

When following the tutorial this appears…

Right clicking > set linked image > desired image, does nothing
Same for right clicking > set image > desired image

When doing my method the same result happens when running the code, but right clicking > set image > desired image, makes the image appear perfectly.

Just wondering where I’m going wrong here, thanks.

My attempt is the following…

IImageShapeUIModel imageShape = (IImageShapeUIModel) diagramManager.createDiagramElement(technologiesDiagram, IModelElementFactory.instance().createImageShape());
String imagePath = "/Users/{my_name}/Documents/AppEngine.png";
BufferedImage image = null;
try {
    File file = new File(imagePath);
    image =;
} catch (Exception ex) {
imageShape.setBounds(100, 100, 284, 137);
System.out.println(imageShape.getEmbeddedPath());     //PRINTS SAME AS IMAGEPATH
System.out.println(imageShape.getDisplayImagePath()); //PRINTS SAME AS IMAGEPATH
System.out.println(imageShape.getImagePath());        //PRINTS SAME AS IMAGEPATH
System.out.println(imageShape.getLinkedFilePath());   //PRINTS SAME AS IMAGEPATH
Image test = imageShape.getImage();
System.out.println(test.equals((Image) image));       //PRINTS TRUE

Hello, Luke.

Thank you for your inquiry. There are two pop-up menus for image shapes.

  1. Select Image…
  2. Select Link File

To display an image, you must select the first menu “Select Image”. By selecting this menu, you can choose to import the image file as embedded or as linked.

Regarding your code, since you have been able to make the image appear, I think you are doing a good job. If you have any questions, please feel free to let us know.

Best regards.
Jick Yeung