根据用户定义的值将幻灯片渲染为缩略图到JPEG
Contents
 [
      
        Hide
      ]
    使用Aspose.Slides for .NET生成所需幻灯片的缩略图:
- 创建一个Presentation类的实例。
- 使用幻灯片的ID或索引获取任何所需幻灯片的引用。
- 根据用户定义的X和Y尺寸获取X和Y缩放因子。
- 获取引用幻灯片在指定缩放比例下的缩略图图像。
- 将缩略图图像以任何所需的图像格式保存。
string filePath = @"..\..\..\Sample Files\";
string srcFileName = filePath + "用户定义的缩略图.pptx";
string destFileName = filePath + "用户定义的缩略图.jpg";
//实例化代表演示文稿文件的Presentation类
using (Presentation pres = new Presentation(srcFileName))
{
    //访问第一张幻灯片
    ISlide sld = pres.Slides[0];
    //用户定义的尺寸
    int desiredX = 1200;
    int desiredY = 800;
    //获取X和Y的缩放值
    float scaleX = (float)(1.0 / pres.SlideSize.Size.Width) * desiredX;
    float scaleY = (float)(1.0 / pres.SlideSize.Size.Height) * desiredY;
    //创建全尺度图像
    using (IImage image = sld.GetImage(scaleX, scaleY))
    {
        //将图像以JPEG格式保存到磁盘
        image.Save(destFileName, ImageFormat.Jpeg);
    }
}