Skip to content

Commit 3281b02

Browse files
Aspose.Slides for C++ 24.9 API Reference
1 parent 048ff8a commit 3281b02

File tree

2 files changed

+12
-18
lines changed
  • content/cpp/english/aspose.slides

2 files changed

+12
-18
lines changed

content/cpp/english/aspose.slides/ipicturefillformat/compressimage/_index.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,14 @@ if the image was resized or cropped, otherwise ****false****
3939
4040
The following example demonstrates how to use the **CompressImage** method to reduce the size of an image in a presentation by setting a target resolution and removing cropped areas:
4141
```cpp
42-
[C#]
43-
using (Presentation presentation = new Presentation("demo.pptx"))
44-
{
45-
ISlide slide = presentation.Slides[0];
42+
System::SharedPtr<Presentation> presentation = System::MakeObject<Presentation>(u"demo.pptx");
43+
System::SharedPtr<ISlide> slide = presentation->get_Slide(0);
4644
47-
// Gets the PictureFrame
48-
IPictureFrame picFrame = slide.Shapes[0] as IPictureFrame;
45+
// Gets the PictureFrame
46+
System::SharedPtr<IPictureFrame> picFrame = System::AsCast<IPictureFrame>(slide->get_Shape(0));
4947
50-
// Compress the image with a target resolution of 150 DPI (Web resolution) and remove cropped areas
51-
bool result=picFrame.PictureFormat.CompressImage(true, 150f); // Web resolution
52-
}
48+
// Compress the image with a target resolution of 150 DPI (Web resolution) and remove cropped areas
49+
bool result = picFrame->get_PictureFormat()->CompressImage(true, 150.0f); // Web resolution
5350
```
5451

5552
## See Also

content/cpp/english/aspose.slides/picturefillformat/compressimage/_index.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,14 @@ if the image was resized or cropped, otherwise ****false****
3939
4040
The following example demonstrates how to use the **CompressImage** method to reduce the size of an image in a presentation by setting a target resolution and removing cropped areas:
4141
```cpp
42-
[C#]
43-
using (Presentation presentation = new Presentation("demo.pptx"))
44-
{
45-
ISlide slide = presentation.Slides[0];
42+
System::SharedPtr<Presentation> presentation = System::MakeObject<Presentation>(u"demo.pptx");
43+
System::SharedPtr<ISlide> slide = presentation->get_Slide(0);
4644
47-
// Gets the PictureFrame
48-
IPictureFrame picFrame = slide.Shapes[0] as IPictureFrame;
45+
// Gets the PictureFrame
46+
System::SharedPtr<IPictureFrame> picFrame = System::AsCast<IPictureFrame>(slide->get_Shape(0));
4947
50-
// Compress the image with a target resolution of 150 DPI (Web resolution) and remove cropped areas
51-
bool result=picFrame.PictureFormat.CompressImage(true, 150f); // Web resolution
52-
}
48+
// Compress the image with a target resolution of 150 DPI (Web resolution) and remove cropped areas
49+
bool result = picFrame->get_PictureFormat()->CompressImage(true, 150.0f); // Web resolution
5350
```
5451

5552
## See Also

0 commit comments

Comments
 (0)