DEV Community

AsposeDiagram
AsposeDiagram

Posted on • Edited on

1

Convert Microsoft Visio Document to BMP in C#

Developers can convert any Microsoft Visio document to BMP (Bitmap Image File) in C# (or in any other .NET Framework supported language e.g. VB.NET etc.) using Aspose.Diagram which is a light-weight, extensible, easy to use API and helps developers to create, manipulate and convert Microsoft Visio files to various formats on client side and server-side without any need to install Microsoft Visio or using any sort of Microsoft Office automation.

Supported Platforms

Aspose.Diagram supports both .NET and Java platforms. Please see Aspose.Diagram for .NET and Aspose.Diagram for Java for your reference.

Sample Microsoft Visio Document - VSD

For demonstration, we will convert the following sample Microsoft Visio document to BMP in C# using Aspose.Diagram for .NET. However, you can use any Microsoft Visio document of your choice inside the sample code and it will also be converted to BMP fine.

Sample Microsoft Visio Document to be converted to BMP using Aspose.Diagram API.

Licensing

Please note, if you will execute the code without prior setting the Aspose.Diagram license, you will get Evaluation Watermark in your output documents. For more information, please go through Licensing.

Sample Code

The following sample code converts the Microsoft Visio document to BMP by performing these steps.

  • Load Microsoft Visio document to Aspose.Diagram.Diagram object.
  • Specify ImageSaveOptions to set resolution for clear image.
  • Save the Aspose.Diagram.Diagram object into BMP format with specified ImageSaveOptions.
// Path for input and output documents directory.
String dirPath = "D:/Download/";
// Load the sample Microsoft Visio document inside the Aspose.Diagram.Diagram object.
Aspose.Diagram.Diagram dg = new Diagram(dirPath + "SampleConvertMicrosoftVisioDocumentToBMP.vsd");
// Specify Image Save Options - set the resolution of your choice.
Aspose.Diagram.Saving.ImageSaveOptions imgOpts = new Aspose.Diagram.Saving.ImageSaveOptions(SaveFileFormat.BMP);
imgOpts.Resolution = 200;
// Save the Diagram object into BMP format with specified ImageSaveOptions.
dg.Save(dirPath + "OutputConvertMicrosoftVisioDocumentToBMP.bmp", imgOpts);

Output BMP of Microsoft Visio Document by Aspose.Diagram

The following snapshot shows the Output BMP of Microsoft Visio Document generated by Aspose.Diagram with the code given above. As you can see, the BMP looks exactly same as Microsoft Visio document.

Output BMP generated by Aspose.Diagram from Microsoft Visio document.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free