GetImage()
Slide::GetImage(float, float) method
Returns a Thumbnail Image object with custom scaling.
System::SharedPtr<IImage> Aspose::Slides::Slide::GetImage(float scaleX, float scaleY) override
Arguments
Parameter | Type | Description |
---|---|---|
scaleX | float | The value by which to scale this Thumbnail in the x-axis direction. |
scaleY | float | The value by which to scale this Thumbnail in the y-axis direction. |
Return Value
IImage object.
Remarks
The following example shows how to generate thumbnails from PowerPoint Presentation:
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(u"ThumbnailFromSlide.pptx");
// Access the first slide
System::SharedPtr<ISlide> sld = pres->get_Slide(0);
// Create a full scale image
System::SharedPtr<IImage> bmp = sld->GetImage(1.0f, 1.0f);
// Save the image to disk in JPEG format
bmp->Save(u"Thumbnail_out.jpg", Aspose::Slides::ImageFormat::Jpeg);
The following example shows how to converting slides to bitmap and saving the images in PNG:
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(u"Presentation.pptx");
// Converts the first slide in the presentation to a Bitmap object
System::SharedPtr<IImage> bmp = pres->get_Slide(0)->GetImage();
// Saves the image in the PNG format
bmp->Save(u"Slide_0.png", Aspose::Slides::ImageFormat::Png);
The following example shows how to convert PowerPoint PPT/PPTX to JPG:
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(u"PowerPoint-Presentation.ppt");
for (auto&& sld : pres->get_Slides())
{
// Create a full scale image
System::SharedPtr<IImage> bmp = sld->GetImage(1.f, 1.f);
// Save the image to disk in JPEG format
bmp->Save(System::String::Format(u"Slide_{0}.jpg", sld->get_SlideNumber()), Aspose::Slides::ImageFormat::Jpeg);
}
The following example shows how to convert PowerPoint PPT/PPTX to JPG with customized dimensions:
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(u"PowerPoint-Presentation.pptx");
// Define dimensions
int32_t desiredX = 1200;
int32_t desiredY = 800;
// Get scaled values of X and Y
float scaleX = (float)(1.0 / pres->get_SlideSize()->get_Size().get_Width()) * desiredX;
float scaleY = (float)(1.0 / pres->get_SlideSize()->get_Size().get_Height()) * desiredY;
for (auto&& sld : pres->get_Slides())
{
// Create a full scale image
System::SharedPtr<IImage> bmp = sld->GetImage(scaleX, scaleY);
// Save the image to disk in JPEG format
bmp->Save(System::String::Format(u"Slide_{0}.jpg", sld->get_SlideNumber()), Aspose::Slides::ImageFormat::Jpeg);
}
Slide::GetImage() method
Returns a Thumbnail Image object (20% of real size).
System::SharedPtr<IImage> Aspose::Slides::Slide::GetImage() override
Slide::GetImage(System::Drawing::Size) method
Returns a Thumbnail Image object with specified size.
System::SharedPtr<IImage> Aspose::Slides::Slide::GetImage(System::Drawing::Size imageSize) override
Arguments
Parameter | Type | Description |
---|---|---|
imageSize | System::Drawing::Size | Size of the image to create. |
Return Value
Image object.
Remarks
The following example shows how to converting slides to images with custom sizes using C#.
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(u"Presentation.pptx");
// Converts the first slide in the presentation to a Bitmap with the specified size
System::SharedPtr<IImage> bmp = pres->get_Slide(0)->GetImage(System::Drawing::Size(1820, 1040));
// Saves the image in the JPEG format
bmp->Save(u"Slide_0.jpg", Aspose::Slides::ImageFormat::Jpeg);
Slide::GetImage(System::SharedPtr<Export::ITiffOptions>) method
Returns a Thumbnail tiff image object with specified parameters.
System::SharedPtr<IImage> Aspose::Slides::Slide::GetImage(System::SharedPtr<Export::ITiffOptions> options) override
Arguments
Parameter | Type | Description |
---|---|---|
options | System::SharedPtr<Export::ITiffOptions> | Tiff options. |
Return Value
Image object.
Slide::GetImage(System::SharedPtr<Export::IRenderingOptions>) method
Returns a Thumbnail Image object.
System::SharedPtr<IImage> Aspose::Slides::Slide::GetImage(System::SharedPtr<Export::IRenderingOptions> options) override
Arguments
Parameter | Type | Description |
---|---|---|
options | System::SharedPtr<Export::IRenderingOptions> | Rendering options. |
Return Value
Image object.
Slide::GetImage(System::SharedPtr<Export::IRenderingOptions>, float, float) method
Returns a Thumbnail Image object with custom scaling.
System::SharedPtr<IImage> Aspose::Slides::Slide::GetImage(System::SharedPtr<Export::IRenderingOptions> options, float scaleX, float scaleY) override
Arguments
Parameter | Type | Description |
---|---|---|
options | System::SharedPtr<Export::IRenderingOptions> | Rendering options. |
scaleX | float | The value by which to scale this Thumbnail in the x-axis direction. |
scaleY | float | The value by which to scale this Thumbnail in the y-axis direction. |
Return Value
Bitmap objects.
Remarks
The following example shows how to converting slides With notes and comments to Images using C#.
System::SharedPtr<Presentation> pres = System::MakeObject<Presentation>(u"PresentationNotesComments.pptx");
// Create the rendering options
System::SharedPtr<IRenderingOptions> options = System::MakeObject<RenderingOptions>();
// Create notes and comments layouting options
System::SharedPtr<NotesCommentsLayoutingOptions> notesCommentsLayouting = System::MakeObject<NotesCommentsLayoutingOptions>();
// Sets the position of the notes on the page
notesCommentsLayouting->set_NotesPosition(NotesPositions::BottomTruncated);
// Sets the position of the comments on the page
notesCommentsLayouting->set_CommentsPosition(CommentsPositions::Right);
// Sets the width of the comment output area
notesCommentsLayouting->set_CommentsAreaWidth(500);
// Sets the color for the comments area
notesCommentsLayouting->set_CommentsAreaColor(System::Drawing::Color::get_AntiqueWhite());
// Set layout options for rendering
options->set_SlidesLayoutOptions(notesCommentsLayouting);
// Converts the first slide of the presentation to a IImage object
System::SharedPtr<IImage> image = pres->get_Slide(0)->GetImage(options, 2.0f, 2.0f);
// Saves the image in the GIF format
image->Save(u"Slide_Notes_Comments_0.gif", ImageFormat::Gif);
Slide::GetImage(System::SharedPtr<Export::IRenderingOptions>, System::Drawing::Size) method
Returns a Thumbnail Image object with specified size.
System::SharedPtr<IImage> Aspose::Slides::Slide::GetImage(System::SharedPtr<Export::IRenderingOptions> options, System::Drawing::Size imageSize) override
Arguments
Parameter | Type | Description |
---|---|---|
options | System::SharedPtr<Export::IRenderingOptions> | Rendering options. |
imageSize | System::Drawing::Size | Size of the image to create. |
Return Value
Image object.
See Also
- Typedef SharedPtr
- Class IImage
- Class Slide
- Class Size
- Class ITiffOptions
- Class IRenderingOptions
- Namespace Aspose::Slides
- Library Aspose.Slides