First get a link to the ImagePart of your image. The ImagePart class provides the information you are looking for. Here is a sample code:
string fileName = @"c:\temp\myppt.pptx"; using (var doc = PresentationDocument.Open(fileName, false)) { var presentation = doc.PresentationPart.Presentation; foreach (SlideId slide_id in presentation.SlideIdList) { SlidePart slide_part = doc.PresentationPart.GetPartById(slide_id.RelationshipId) as SlidePart; if (slide_part == null || slide_part.Slide == null) continue; Slide slide = slide_part.Slide;
In addition, you can also iterate over all ImagePart from SlidePart using the following code:
// iterate over the image parts of the slide part foreach (var imgPart in slide_part.ImageParts) { Console.Out.WriteLine("uri: {0}",imgPart.Uri); Console.Out.WriteLine("content type: {0}", imgPart.ContentType); }
Hope this helps.
source share