Free Support Forum - aspose.com

How can I specify the DPI of an output Image file of each slide?

Hello,

I'm trying to save an image of each slide in a presentation to a TIFF file. I'm using the Slide.GetThumbnail method to return an Image object. I'm then just using Image.Save to save the file to disk.

Is there a way to specify the output DPI of this file? Or, perhaps an alternative method for saving each slide to an image file?

Thanks

public static void ToTiff(String input, String output)

{

// Open the powerpoint file

Presentation pres = new Presentation(input);

Console.WriteLine("[{0}] {1} slides to process", Path.GetFileNameWithoutExtension(input), pres.Slides.Count);

foreach (Slide slide in pres.Slides)

{

Console.WriteLine(" - Processing slide #{0}", slide.SlideId);

// Save the slide to file

Image image = slide.GetThumbnail(1.0, 1.0);

// Specify 300x300 dpi

// Save image to file

image.Save(String.Format(@"{0}\{1}_Slide{2}.tif", output, Path.GetFileNameWithoutExtension(input), slide.SlideId), ImageFormat.Tiff);

}

}

Hi Ryan,

Thanks for your interest in Aspose.Slides.

Unfortunately, there is no way to set the DPI in Aspose.Slides. However, I can suggest you to try using Image.SetResolution method after you have created the image.

<span style=“font-size: 10pt; line-height: 115%; font-family: “Arial”,“sans-serif”;”>We
are sorry for the inconvenience.