11using Syncfusion . Presentation ;
2- using System . IO ;
2+ using Syncfusion . Drawing ;
33
44public static class Program
55{
66 public static void Main ( )
77 {
88 // Open the PowerPoint file as a stream.
9- using ( FileStream inputStream = new FileStream ( @"../../../ Data/Input.pptx", FileMode . Open , FileAccess . Read ) )
9+ using ( FileStream inputStream = new FileStream ( Path . GetFullPath ( @" Data/Input.pptx", FileMode . Open , FileAccess . Read ) )
1010 {
1111 // Load the presentation from the stream.
1212 using ( IPresentation presentation = Presentation . Open ( inputStream ) )
@@ -20,7 +20,7 @@ public static void Main()
2020 foreach ( IShape shape in slide . Shapes )
2121 {
2222 // Check if the shape is an image.
23- if ( shape is IPicture picture )
23+ if ( shape is IPicture picture && picture . ImageFormat == ImageFormat . Emf )
2424 {
2525 // Retrieve the raw image data.
2626 byte [ ] imageData = picture . ImageData ;
@@ -30,7 +30,7 @@ public static void Main()
3030 {
3131 // Determine the image format extension.
3232 string extension = picture . ImageFormat . ToString ( ) ;
33- string outputPath = Path . Combine ( $ "../../../ Output/Slide{ slide . SlideNumber } _Image{ ++ imageIndex } .{ extension } ") ;
33+ string outputPath = Path . Combine ( $ "Output/Slide{ slide . SlideNumber } _Image{ ++ imageIndex } .{ extension } ") ;
3434 // Save the image data to the specified path.
3535 File . WriteAllBytes ( outputPath , imageData ) ;
3636 }
0 commit comments