How do I change the “Transparency” property of a background image (as shown below)?
image.png (8.1 KB)
How do I change the “Transparency” property of a background image (as shown below)?
image.png (8.1 KB)
@bingxie,
Thank you for posting your requirements.
The background transparency is changed by using image effects. The following code snippet shows you how to change the background transparency.
var transparencyValue = 30; // for example
// Get a collection of picture transform operations.
var imageTransform = slide.Background.FillFormat.PictureFillFormat.Picture.ImageTransform;
// Find a transparency effect with fixed percentage.
var transparencyOperation = null as AlphaModulateFixed;
foreach (var operation in imageTransform)
{
if (operation is AlphaModulateFixed alphaModulateFixed)
{
transparencyOperation = alphaModulateFixed;
break;
}
}
// Set the new transparency value.
if (transparencyOperation == null)
{
imageTransform.AddAlphaModulateFixedEffect(100 - transparencyValue);
}
else
{
transparencyOperation.Amount = (100 - transparencyValue);
}