Read the complete article on converting PowerPoint presentations to TIFF in C#: https://blog.aspose.com/2021/08/11/convert-powerpoint-to-tiff-using-csharp/
Last active
August 12, 2021 06:38
-
-
Save aspose-com-gists/5c21d384f432926aa70f16160966467b to your computer and use it in GitHub Desktop.
Convert PowerPoint to TIFF in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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