Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active August 13, 2022 05:00
Show Gist options
  • Save aspose-com-kb/32257abf78807e436c352c30dc183d9b to your computer and use it in GitHub Desktop.
Save aspose-com-kb/32257abf78807e436c352c30dc183d9b to your computer and use it in GitHub Desktop.
Code to Convert Visio to JPG in C#. For more details: https://kb.aspose.com/diagram/net/how-to-convert-visio-to-jpg-in-csharp/
namespace AsposeProjects
{
class Program
{
static void Main(string[] args) // Main function to convert VSDX to JPG
{
// Load the license
Aspose.Diagram.License lic = new Aspose.Diagram.License();
lic.SetLicense(@"Aspose.Total.lic");
// Load input VSD VSDX Visio file
Aspose.Diagram.Diagram diagram = new Aspose.Diagram.Diagram("VisioToJPG.vsdx");
// Specify output image format as JPG
Aspose.Diagram.Saving.ImageSaveOptions options = new Aspose.Diagram.Saving.ImageSaveOptions(Aspose.Diagram.SaveFileFormat.Jpeg);
// Set quality for the output image
options.JpegQuality = 50;
// Save the resultant Image file
diagram.Save("VisioToJPG.jpg", options);
System.Console.WriteLine("Done");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment