GetThumbnail

GetThumbnail(float, float)

Returns a Thumbnail Bitmap object with custom scaling.

public Bitmap GetThumbnail(float scaleX, float scaleY)
ParameterTypeDescription
scaleXSingleThe value by which to scale this Thumbnail in the x-axis direction.
scaleYSingleThe value by which to scale this Thumbnail in the y-axis direction.

Return Value

Bitmap object.

Examples

The following example shows how to generate thumbnails from PowerPoint Presentation.

[C#]
// Instantiate a Presentation class that represents the presentation file
using (Presentation pres = new Presentation("ThumbnailFromSlide.pptx"))
{
    // Access the first slide
    ISlide sld = pres.Slides[0];
    // Create a full scale image
    Bitmap bmp = sld.GetThumbnail(1f, 1f);
    // Save the image to disk in JPEG format
    bmp.Save("Thumbnail_out.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
}

The following example shows how to converting slides to bitmap and saving the images in PNG.

[C#]
using (Presentation pres = new Presentation("Presentation.pptx"))
{
    // Converts the first slide in the presentation to a Bitmap object
    using (Bitmap bmp = pres.Slides[0].GetThumbnail())
    {
        // Saves the image in the PNG format
        bmp.Save("Slide_0.png", ImageFormat.Png);
    }
}

The following example shows how to convert PowerPoint PPT/PPTX to JPG.

[C#]
using (Presentation pres = new Presentation("PowerPoint-Presentation.ppt"))
{
	foreach (ISlide sld in pres.Slides)
	{
		// Create a full scale image
		Bitmap bmp = sld.GetThumbnail(1f, 1f);
		// Save the image to disk in JPEG format
		bmp.Save(string.Format("Slide_{0}.jpg", sld.SlideNumber), System.Drawing.Imaging.ImageFormat.Jpeg);
	}
}

The following example shows how to convert PowerPoint PPT/PPTX to JPG with customized dimensions.

[C#]
using (Presentation pres = new Presentation("PowerPoint-Presentation.pptx"))
{
	// Define dimensions
	int desiredX = 1200;
	int desiredY = 800;
	// Get scaled values of X and Y
	float ScaleX = (float)(1.0 / pres.SlideSize.Size.Width) * desiredX;
	float ScaleY = (float)(1.0 / pres.SlideSize.Size.Height) * desiredY;
	foreach (ISlide sld in pres.Slides)
	{
		// Create a full scale image
		Bitmap bmp = sld.GetThumbnail(ScaleX, ScaleY);
		// Save the image to disk in JPEG format
		bmp.Save(string.Format("Slide_{0}.jpg", sld.SlideNumber), System.Drawing.Imaging.ImageFormat.Jpeg);
	}
}

See Also


GetThumbnail()

Returns a Thumbnail Image object (20% of real size).

public Bitmap GetThumbnail()

See Also


GetThumbnail(Size)

Returns a Thumbnail Bitmap object with specified size.

public Bitmap GetThumbnail(Size imageSize)
ParameterTypeDescription
imageSizeSizeSize of the image to create.

Return Value

Bitmap object.

Examples

The following example shows how to converting slides to images with custom sizes using C#.

using (Presentation pres = new Presentation("Presentation.pptx"))
{
    // Converts the first slide in the presentation to a Bitmap with the specified size
    using (Bitmap bmp = pres.Slides[0].GetThumbnail(new Size(1820, 1040)))
    {
        // Saves the image in the JPEG format
        bmp.Save("Slide_0.jpg", ImageFormat.Jpeg);
    }
}

See Also


GetThumbnail(ITiffOptions)

Returns a Thumbnail tiff bitmap object with specified parameters.

public Bitmap GetThumbnail(ITiffOptions options)
ParameterTypeDescription
optionsITiffOptionsTiff options.

Return Value

Bitmap object.

Exceptions

exceptioncondition
InvalidOperationExceptionThrown when options.NotesCommentsLayouting.NotesPosition takes the value NotesPositions.BottomFull.

See Also


GetThumbnail(IRenderingOptions)

Returns a Thumbnail Bitmap object.

public Bitmap GetThumbnail(IRenderingOptions options)
ParameterTypeDescription
optionsIRenderingOptionsRendering options.

Return Value

Bitmap objects.

Exceptions

exceptioncondition
InvalidOperationExceptionThrown when notesCommentsLayouting.NotesPosition takes the value NotesPositions.BottomFull

See Also


GetThumbnail(IRenderingOptions, float, float)

Returns a Thumbnail Bitmap object with custom scaling.

public Bitmap GetThumbnail(IRenderingOptions options, float scaleX, float scaleY)
ParameterTypeDescription
optionsIRenderingOptionsRendering options.
scaleXSingleThe value by which to scale this Thumbnail in the x-axis direction.
scaleYSingleThe value by which to scale this Thumbnail in the y-axis direction.

Return Value

Bitmap objects.

Exceptions

exceptioncondition
InvalidOperationExceptionThrown when notesCommentsLayouting.NotesPosition takes the value NotesPositions.BottomFull

Examples

The following example shows how to converting slides With notes and comments to Images using C#.

using (Presentation pres = new Presentation("PresentationNotesComments.pptx"))
{
    // Creates the rendering options
    IRenderingOptions options = new RenderingOptions();
    // Sets the position of the notes on the page
    options.NotesCommentsLayouting.NotesPosition = NotesPositions.BottomTruncated;
    // Sets the position of the comments on the page
    options.NotesCommentsLayouting.CommentsPosition = CommentsPositions.Right;
    // Sets the width of the comment output area
    options.NotesCommentsLayouting.CommentsAreaWidth = 500;
    // Sets the color for the comments area
    options.NotesCommentsLayouting.CommentsAreaColor = Color.AntiqueWhite;
    // Converts the first slide of the presentation to a Bitmap object
    Bitmap bmp = pres.Slides[0].GetThumbnail(options, 2f, 2f);
    // Saves the image in the GIF format
    bmp.Save("Slide_Notes_Comments_0.gif", ImageFormat.Gif);
}

See Also


GetThumbnail(IRenderingOptions, Size)

Returns a Thumbnail Bitmap object with specified size.

public Bitmap GetThumbnail(IRenderingOptions options, Size imageSize)
ParameterTypeDescription
optionsIRenderingOptionsRendering options.
imageSizeSizeSize of the image to create.

Return Value

Bitmap objects.

Exceptions

exceptioncondition
InvalidOperationExceptionThrown when options.NotesCommentsLayouting.NotesPosition takes the value NotesPositions.BottomFull

See Also