Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active December 22, 2021 20:34
Show Gist options
  • Save aspose-com-gists/dc5a15672203e863d902ce3187544fcc to your computer and use it in GitHub Desktop.
Save aspose-com-gists/dc5a15672203e863d902ce3187544fcc to your computer and use it in GitHub Desktop.
Convert Visio VSD or VSDX Drawing or Diagram File to PNG or JPG Image in Java
// Load input diagram as VSD/VSDX file
Diagram diagram = new Diagram("ExportPageToImage.vsd");
// Specify output image format as PNG
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG);
// Save one page only, by page index
options.setPageIndex(0);
// Save resultant Image file
diagram.save("ExportPageToImage_out.png", options);
// Call the diagram constructor to load input VSD/VSDX drawing
Diagram diagram = new Diagram("ExportToImage.vsd");
// Save output JPG, SVG, BMP, GIF, or SVG Image file
diagram.save("ExportToImage_out.png", SaveFileFormat.PNG);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment