We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Wrong image format returned by Aspose.Slides

Hi there

Im trying to extract the images from a PPT file and write them to disk using Aspose.Slides.
These images are stored as an ArrayList of Aspose.Slides.Picture objects, and when extracting them, we build a filename for them and use the Aspose.Slides.Picture.ImageFormat property to determine the file extension of the image to use.

However in some cases we are finding that the property is returning the JPEG extension, even though upon inspection of the image file’s header, it actually turns out to be a PNG file. Is this a known bug with Aspose.Slides?



Hi Eric,

Can you please provide a sample test case for investigation?

Hi Muhammad

Sure - the file is attached


Hi Eric,

I shall investigate the issue and will be back to you in a couple of days.

Hi Eric,

I did not find any wrong image format read by Aspose. Can you identify from the attached zip file having images that were created as a result of following code?

Presentation pres = new Presentation("hynes.ppt");

foreach (Picture pic in pres.Pictures)


System.Drawing.Image img= pic.Image;

img.Save("d:\\ppt\\cb\\img\\" + pic.ImageFormat.ToString() + pic.PictureId.ToString() + "." + pic.ImageFormat, pic.ImageFormat);


Hi Muhammad

Thanks for your reply - using your code the problem is fixed :slight_smile:

I wasn’t specifying the second imgFormat parameter in the Picture.Save method

Thanks for your help