Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active August 12, 2021 06:38
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/5c21d384f432926aa70f16160966467b to your computer and use it in GitHub Desktop.
Save aspose-com-gists/5c21d384f432926aa70f16160966467b to your computer and use it in GitHub Desktop.
Convert PowerPoint to TIFF in C#
// Instantiate a Presentation object that represents a Presentation file
using (Presentation pres = new Presentation("Presentation.pptx"))
{
// Instantiate the TiffOptions class
TiffOptions opts = new TiffOptions();
// Setting compression type
opts.CompressionType = TiffCompressionTypes.Default;
// Depth depends on the compression type and cannot be set manually.
// Resolution unit is always equal to “2” (dots per inch)
// Setting image DPI
opts.DpiX = 200;
opts.DpiY = 100;
// Set Image Size
opts.ImageSize = new Size(1728, 1078);
// Save the presentation to TIFF with specified image size
pres.Save("TiffWithCustomSize_out.tiff", SaveFormat.Tiff, opts);
}
// Instantiate a Presentation object that represents a Presentation file
using (Presentation presentation = new Presentation("Presentation.pptx"))
{
TiffOptions options = new TiffOptions();
options.PixelFormat = ImagePixelFormat.Format8bppIndexed;
/*
ImagePixelFormat contains the following values (as could be seen from documentation):
Format1bppIndexed; // 1 bits per pixel, indexed.
Format4bppIndexed; // 4 bits per pixel, indexed.
Format8bppIndexed; // 8 bits per pixel, indexed.
Format24bppRgb; // 24 bits per pixel, RGB.
Format32bppArgb; // 32 bits per pixel, ARGB.
*/
// Save the presentation to TIFF with specified image size
presentation.Save("Tiff_With_Custom_Image_Pixel_Format_out.tiff", SaveFormat.Tiff, options);
}
// Instantiate a Presentation object that represents a presentation file
using (Presentation presentation = new Presentation("Presentation.pptx"))
{
// Saving the presentation to TIFF document
presentation.Save("output.tiff", SaveFormat.Tiff);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment