Created
December 10, 2025 08:35
-
-
Save conholdate-gists/ea90b9dbde4060a741e70d3fb2500683 to your computer and use it in GitHub Desktop.
Convert PPT to JPG with Conholdate.Total for .NET
This file contains hidden or 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
| // Convert PPT to JPG - Complete Code Example | |
| using System; | |
| using System.Drawing; | |
| using System.Drawing.Imaging; | |
| using Conholdate.Total.Slides; // Namespace for presentation handling | |
| namespace PptToJpgDemo | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| // Path to the source PowerPoint file (PPT or PPTX) | |
| string sourcePath = "sample.pptx"; | |
| // Output folder for JPG images | |
| string outputFolder = "output_images"; | |
| try | |
| { | |
| // Ensure output directory exists | |
| System.IO.Directory.CreateDirectory(outputFolder); | |
| // Load the presentation | |
| using (Presentation presentation = new Presentation(sourcePath)) | |
| { | |
| // Loop through each slide | |
| for (int i = 0; i < presentation.Slides.Count; i++) | |
| { | |
| // Get a bitmap of the slide (you can set scaling factors if needed) | |
| using (Bitmap slideBitmap = presentation.Slides[i].GetThumbnail(1.0f, 1.0f)) | |
| { | |
| // Build the output file name | |
| string outputPath = System.IO.Path.Combine( | |
| outputFolder, $"slide_{i + 1}.jpg"); | |
| // Save as JPEG with default quality | |
| slideBitmap.Save(outputPath, ImageFormat.Jpeg); | |
| Console.WriteLine($"Saved slide {i + 1} to {outputPath}"); | |
| } | |
| } | |
| } | |
| Console.WriteLine("Conversion completed successfully."); | |
| } | |
| catch (Exception ex) | |
| { | |
| Console.Error.WriteLine($"Error during conversion: {ex.Message}"); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment