Generating a Thumbnail from a Slide with User Defined Dimensions
Contents
[
Hide
]
To generate the thumbnail of any desired slide using Aspose.Slides for .NET:
- Create an instance of the Presentation class.
- Obtain the reference of any desired slide by using its ID or index.
- Get the X and Y scaling factors based on user defined X and Y dimensions.
- Get the thumbnail image of the referenced slide on a specified scale.
- Save the thumbnail image in any desired image format.
Example
//Instantiate the Presentation class that represents the presentation file
using (Presentation pres = new Presentation("TestPresentation.pptx"))
{
//Access the first slide
ISlide sld = pres.Slides[0];
//User defined dimension
int desiredX = 1200;
int desiredY = 800;
//Getting scaled value of X and Y
float scaleX = (float)(1.0 / pres.SlideSize.Size.Width) * desiredX;
float scaleY = (float)(1.0 / pres.SlideSize.Size.Height) * desiredY;
//Create a full scale image
using (IImage image = sld.GetImage(scaleX, scaleY))
{
//Save the image to disk in JPEG format
image.Save("Thumbnail2.jpg", ImageFormat.Jpeg);
}
}
Download Running Example
- [CodePlex](https://asposeslidesvsto.codeplex.com/SourceControl/latest#Aspose.Slides Features missing in VSTO/User Defined Thumbnail/)
- GitHub
- Code.MSDN
Download Sample Code
For more details, visit Creating Slides Thumbnail Image.