Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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