How to Manage Images in PowerPoint

Multimedia elements form the integral structure of a PowerPoint presentation. Images, in particular, provide visual context and reinforce the information presented on each slide. Effective image management (whether inserting new visuals, updating existing ones, or cleaning up outdated graphics) is imperative for maintaining professional and scalable presentations.

This guide demonstrates how to work with images programmatically using IronPPT.

Get started with IronPPT


Add Image

To add an image in a PowerPoint document using IronPPT, create a new document object (or load from an existing file). Then, create an image object from the Image class that references a file. Once the image is loaded, add it to the document and specify the slide number where it should appear. From there, image attributes can be altered using properties such as Height, Width, and Angle. Finally, export the document with the newly added image.

:path=/static-assets/ppt/content-code-examples/how-to/manage-image-add-image-add-image.cs
using IronPPT;
using IronPPT.Models;

// Create a new presentation document
var document = new PresentationDocument();

// Create and load an image from file
Image image = new Image();
image.LoadFromFile("image.jpg");

// Add image to the first slide (index 0)
var newImage = document.AddImage(image, 0);

// Rotate the image 180 degrees
newImage.Angle = 180;

// Save the presentation as a PPTX file
document.Save("adding-image.pptx");
$vbLabelText   $csharpLabel
Add image to PowerPoint slide

Image Properties

Explore image property options in the table below.

PropertyDescriptionExample
HeightSets the height of the image in points.image.Height = 300;
WidthSets the width of the image in points.image.Width = 400;
AngleRotates the image by a specified angle in degrees.image.Angle = 45;
PositionSets the position of the image on the slide using x and y coordinates.image.Position = (200, 200);
FrameShapeSets the frame shape of the image using ShapeType enum values.image.FrameShape = IronPPT.Enums.ShapeType.RoundRectangle;

Modifying Added Image Properties

After adding an image to a slide, you can modify its properties to adjust appearance and positioning. E.g., using properties like Height, Width, and Angle to customize the image dimensions and rotation. Tweaking these settings lets you to fine-tune how the image appears in your presentation.

:path=/static-assets/ppt/content-code-examples/how-to/manage-image-add-image-modify-properties.cs
using IronPPT;
using IronPPT.Models;
using IronPPT.Enums;

// Load an existing presentation document
var document = new PresentationDocument("existing-presentation.pptx");

// Create and load an image from file
Image image = new Image();
image.LoadFromFile("image.jpg");

// Add image to the second slide (index 1)
var newImage = document.AddImage(image, 1);

// Modify image properties
newImage.Angle = 45; // Rotate the image 45 degrees
newImage.FrameShape = ShapeType.RoundRectangle; // Set the frame shape to Rounded Rectangle
newImage.Position = (180, 180); // Set the position to coordinates (180, 180)
newImage.Width = 300; // Set the width to 300 points
newImage.Height = 300; // Set the height to 300 points

// Save the modified presentation as a new PPTX file
document.Save("modifying-image-properties.pptx");
$vbLabelText   $csharpLabel
Modify image properties in PowerPoint

Replace Image

Replacing an image is an intuitive task with IronPPT. First, load the presentation document and your new image into a fresh Image object. Then, target the image you wish to update by selecting its slide and index, such as Slides[0].Images[0] (for the first image on the first slide). Once complete, call the Replace method using the new image object and export the file.

:path=/static-assets/ppt/content-code-examples/how-to/manage-image-replace-image-replace-image.cs
using IronPPT;
using IronPPT.Models;

// Load an existing presentation
var document = new PresentationDocument("sample.pptx");

// Load the replacement image
Image replaceImage = new Image();
replaceImage.LoadFromFile("sample.png");

// Replace the first image found in the first slide
document.Slides[0].Images[0].Replace(replaceImage);

// Save changes (overwriting the original file)
document.Save("sample.pptx");
$vbLabelText   $csharpLabel

Original

Replace image on a PowerPoint slide (Before replacement)

Result

Replace image on a PowerPoint slide (After replacement)

Remove Image by Index

The simplest way to remove an image is by its index position. Access the slide's image collection and use the Remove method with the zero-based index of the image you want to delete. This approach works well when you know the exact position of the image in the collection.

:path=/static-assets/ppt/content-code-examples/how-to/manage-image-remove-image-remove-by-index.cs
using IronPPT;

// Create a new presentation
var document = new PresentationDocument("real_sample.pptx");

// Remove the first image found in the first slide
document.Slides[1].Images[0].Remove();

// Save the updated presentation
document.Save("removed-image.pptx");
$vbLabelText   $csharpLabel

Before Image Removal

Remove image by index from PowerPoint slide (before view)

After Image Removal

Remove image by index from PowerPoint slide (after view)

Removing All Images

For scenarios where there needs to be a bulk deletion for all of the Image files in a document, we can use two for loops: once to iterate through all document pages, and twice to reiterate through and remove all the identified images per page. An example is shown below.

:path=/static-assets/ppt/content-code-examples/how-to/manage-image-remove-all-images.cs
using IronPPT;
using IronPPT.Models;

// Load an existing presentation
var document = new PresentationDocument("real_sample.pptx");

// Remove all images from every slide
for (int s = 0; s < document.Slides.Count; s++)       // Loop through all slides
{
    var slide = document.Slides[s];                   // Get the current slide

    for (int i = slide.Images.Count - 1; i >= 0; i--) // Loop backward through images on this slide
    {
        slide.Images[i].Remove();                     // Remove each image
    }
}

// Save the updated presentation
document.Save("removed-images.pptx");
$vbLabelText   $csharpLabel

Before Bulk Deletion

Remove image by index from PowerPoint slide in bulk (before view)

After Bulk Deletion

As you can see, all the images are removed from slides 2 and 4.

Remove image by index from PowerPoint slide in bulk (after view)

Frequently Asked Questions

What image file formats can I use when adding images to PowerPoint presentations?

IronPPT supports common image formats including JPEG, PNG, BMP, GIF, and TIFF. The library automatically handles format conversion and optimization when adding images to presentations, ensuring compatibility with most image sources.

How do I add an image to a specific slide in my presentation?

To add an image using IronPPT, first create an image object using Image.Create() with your image file path, then add it to a specific slide using slide.Images.Add(). You can access slides by index, for example: ppt.Slides[0].Images.Add(image) adds the image to the first slide.

Can I control the size and dimensions of images programmatically?

Yes, IronPPT allows you to set image dimensions using the Width and Height properties of the Image object. Simply assign values in points to these properties before or after adding the image to a slide, such as image.Width = 400 and image.Height = 300.

How do I position images at specific locations on a slide?

IronPPT enables precise image positioning using the Position property with x,y coordinates. The coordinate system starts at the top-left corner (0,0) with values in points, allowing you to place images anywhere on the slide surface.

Is it possible to replace existing images in a PowerPoint presentation?

Yes, IronPPT supports replacing existing images in presentations. You can identify images to replace and substitute them with new image objects while maintaining the same position and properties, ensuring seamless updates to your visual content.

Can I remove images from slides programmatically?

IronPPT provides functionality to remove images either individually or in bulk from your presentations. You can remove specific images by accessing the slide's Images collection and using appropriate removal methods.

Ahmad Sohail
Full Stack Developer

Ahmad is a full-stack developer with a strong foundation in C#, Python, and web technologies. He has a deep interest in building scalable software solutions and enjoys exploring how design and functionality meet in real-world applications.

Before joining the Iron Software team, Ahmad worked on automation projects ...

Read More
Ready to Get Started?
Nuget Downloads 3,682 | Version: 2025.12 just released