"Tutorials > Spire.Presentation >Spire.Presentation Program Guide >Conversion" we're getting blurry images. Is there something we're missing that will give us a clearer resolution? We tried taking the scaling off but that made it worse.
Code:
- Code: Select all
static void Main(string[] args)
{
int no_images = 0;
string test_dir = @"C:\Test\Adhoc Images\adhoc_test.pptx";
string output_dir = @"C:\Test\Adhoc Images\Output\";
try
{
Presentation ppt = new Presentation();
ppt.LoadFromFile(test_dir, FileFormat.Auto);
Directory.CreateDirectory(test_dir);
Directory.CreateDirectory(output_dir);
no_images = ppt.Slides.Count;
for (int i = 0; i < ppt.Slides.Count; i++)
{
int img_width = 1075;
int img_height = 710;
Image img = ppt.Slides[i].SaveAsImage(img_width, img_height);
string datetime = DateTime.Now.ToString("yyyyMMddhhmmss");
string filename = datetime + "_" + i + "_" + ".png";
img.Save(output_dir + filename, ImageFormat.Png);
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}