Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/05bd9878e2618d39e0633beccc2eb507 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/05bd9878e2618d39e0633beccc2eb507 to your computer and use it in GitHub Desktop.
Convert MS Project MPP to Images (PNG, JPEG, BMP, TIFF) using C# | https://blog.aspose.com/2021/08/12/convert-ms-project-mpp-to-images-png-jpeg-bmp-tiff-using-csharp/
// Load the MPP file
Project project = new Project("SourceDirectory\\Tasks\\project_test.mpp");
// Create an instance of the ImageSaveOptions class
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.BMP);
// Save the BMP image
project.Save("OutputDirectory\\image_out.bmp", (SaveOptions)options);
// Load the MPP file
Project project = new Project("SourceDirectory\\Tasks\\project_test.mpp");
// In order to manipulate JPEG quality, you can use ImageSaveOptions.JpegQuality property.
// The allowed value range is from 0 to 100.
// Create an instance of the ImageSaveOptions class
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.JPEG) { JpegQuality = 50 };
// Save the JPEG image
project.Save("OutputDirectory\\image_out.jpeg", (SaveOptions)options);
// Load the MPP file
Project project = new Project("SourceDirectory\\Tasks\\project_test.mpp");
// Create an instance of the ImageSaveOptions class
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.TIFF);
// Save the TIFF image
project.Save("OutputDirectory\\RenderMultipageTIFF_out.tif", (SaveOptions)options);
// Load the MPP file
Project project = new Project("SourceDirectory\\Tasks\\project_test.mpp");
// Create an instance of the ImageSaveOptions class
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG);
// Save the PNG image
project.Save("OutputDirectory\\image_out.png", (SaveOptions)options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment