Hi team,
I am using aspose slides for cpp. How can I extract image tranparency property out of picture frame ? I did not find any such property on pictureFrame or pictureFillFormat or pictureFillEffect
Thanks
Hi team,
I am using aspose slides for cpp. How can I extract image tranparency property out of picture frame ? I did not find any such property on pictureFrame or pictureFillFormat or pictureFillEffect
Thanks
To extract the transparency property of an image from a picture frame using Aspose.Slides for C++, you can utilize the ImageTransform
collection associated with the picture. This collection contains various effects that can be applied to images, including transparency.
Here’s a general approach you can follow:
IPictureFrame
from your slide.ImageTransform
collection from the picture’s format.ImageTransform
collection to find the transparency effect.Here is a code example that demonstrates how to achieve this:
// Assuming you have a presentation object
auto presentation = MakeObject<Presentation>(u"your_presentation.pptx");
// Access the first slide
auto slide = presentation->get_Slides()->idx_get(0);
// Access the first picture frame
auto pictureFrame = DynamicCast<IPictureFrame>(slide->get_Shapes()->idx_get(0));
// Get the image transform effects
auto imageTransform = pictureFrame->get_PictureFormat()->get_Picture()->get_ImageTransform();
// Iterate through the effects to find transparency
for (auto effect : imageTransform)
{
if (effect->is<IAlphaModulateFixed>())
{
auto alphaModulateFixed = DynamicCast<IAlphaModulateFixed>(effect);
double transparencyValue = 100 - alphaModulateFixed->get_Amount();
std::cout << "Picture transparency: " << transparencyValue << std::endl;
}
}
In this example, the transparency value is calculated by subtracting the amount of the IAlphaModulateFixed
effect from 100, which gives you the transparency percentage of the image.
Make sure to adjust the code according to your specific implementation and the version of Aspose.Slides for C++ you are using.
Thanks for the prompt reply.
Could you help with how to extract image blur property?
@pankajku,
You can extract the blur effect applied to an image in a PowerPoint presentation in the same way. Try using the sample code below.
for (auto effect : imageTransform)
{
if (ObjectExt::Is<IBlur>(effect))
{
auto blur = ExplicitCast<IBlur>(effect);
double radius = blur->get_Radius();
bool grow = blur->get_Grow();
// ...
}
}
All effects are listed here: Aspose::Slides::Effects | Aspose.Slides for C++ API Reference