This article describes how to edit image in PowerPoint using C#. It includes details on setting up the IDE, a list of steps, and sample code for picture editing in PowerPoint using C#. The article also suggests enhancements by introducing additional techniques to edit the picture in the resulting PPT/PPTX.
Steps to Edit Photo in PowerPoint using C#
- Set up the environment to use Aspose.Slides for .NET to edit an image in a presentation
- Load the presentation with the target image to be modified
- Search for the desired image on the selected slide
- Replace the target image with a new image from the disk
- Perform further changes by changing the picture’s position and size, flipping it horizontally, and rotating it slightly
- Crop some part of the picture from the left and right sides of the image
- Change the picture to grayscale and raise its contrast and brightness
- Add a border and a shadow to the picture, set alternate text for the picture and lock its aspect ratio
- Save the modified presentation
These steps summarize the image editing in PowerPoint using C#. Load the source presentation into memory, find the target slide and image, replace the image with a new image from a file on the disk, change the image position and size, flip it, and change its orientation slightly. Further edit the picture by cropping it from the left and right sides, setting it to grayscale, adjusting brightness and contrast, adding a border, and adding a shadow before saving it.
Code to Edit a Picture in PowerPoint using C#
This code demonstrates how to change a picture in PowerPoint using C#. Replace the image in place to update all the slides showing this image; read the new image dimensions first to resize the picture frame to avoid picture distortion, scale the frame as a percentage instead of fixed values, and crop the top and bottom of the picture when required. To reduce the presentation size, permanently delete the cropped areas.
This article has taught about chaining pictures in PPT or PPTX. To compress a presentation, refer to the article Compress PowerPoint presentation Size using C#.