Convert Visio to Images formats

Exporting Diagrams to Image File Formats

This article explains how to export a Microsoft Visio diagram to an image using Aspose.Diagram for Java API.

Use the Diagram class' constructor to read the diagram files and the Save method to export the diagram to any supported image format.The image below shows a VSD file about to be saved to PNG format. You can use other diagram formats (VSS, VSSX, VSSM, VDX, VST, VSTX, VSTM, VDX, VTX or VSX) as well. The source file. Note that the Arrow and Triangle labels are in bold.

todo:image_alt_text

To export a diagram to an image:

  • Create an instance of the Diagram class.
  • Call the Diagram class' Save method and set the image format you want to export to.The output image file looks like the original file.

The output PNG file.

todo:image_alt_text

Exporting to Image File Programming Sample

// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(ExportToImage.class);
// Call the diagram constructor to load diagram from a VSD file
Diagram diagram = new Diagram(dataDir + "ExportToImage.vsd");
// Save as PNG
diagram.save(dataDir+ "ExportToImage_Out.png", SaveFileFormat.PNG);

It is also possible to save a particular page to image, instead of the entire document:

// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(ExportPageToImage.class);
// load diagram
Diagram diagram = new Diagram(dataDir + "ExportPageToImage.vsd");
//Save diagram as PNG
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG);
// Save one page only, by page index
options.setPageIndex(0);
//Save resultant Image file
diagram.save(dataDir + "ExportPageToImage_Out.png", options);