Exporting Vector Images from Presentations in C# Throws ArgumentNullException

Hi Team,

I am facing an issue with emf/wmf vector image files embedded in Powerpoint files.
I am trying to save such a vector images into memory stream but it fails with the following exception:

System.ArgumentNullException: Value cannot be null. (Parameter 'encoder')
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageFormat format)

I’ve tried it on windows platform with Aspose.Slides 21.11

I have implemented an example solution to demonstrate this issue.
Please find it attached.

Thanks, Zoltan
WmfEmfImageExportFailedInSlides.zip (292.1 KB)

@zpopswat,
Thank you for the issue description.

I reproduced the problem with exporting vector images and added a ticket with ID SLIDESNET-42933 in our issue tracking system. Our development team will investigate this case. We will inform you of any progress.

Please try to extract the images as shown here.

@andrey.potapov I’ve tried this use case with the latest Aspose.Slides.NET 24.1.0 but the issue still persists.
Can you please give me some heads up as to when this will be fixed.
Thank you!

@zpopswat,
The issue is still open. Unfortunately, I don’t have any additional information yet. We apologize for any inconvenience caused. I’ve requested plans for the issue from our development team. We will let you know soon.

@zpopswat,
Our developers will begin investigating the issue next week. Thank you for your patience.

@zpopswat,
Our developers have investigated the case. The

image.SystemImage.Save(memoryStream, image.SystemImage.RawFormat);

method is a part of the .NET Framework and is not related to the Aspose.Slides for .NET library.
To work with WMF files in .NET, it is necessary to have a codec installed that supports handling images in this format. Unfortunately, the .NET Framework does not include built-in support for the WMF codec.

To enable support for WMF files, you should use a third-party library that provides WMF codec support. After installing the library, you will be able to use it to work with WMF files in your C# project.

But in your case, there is no need to use the Save method, since the byte array of the original image is in the image.BinaryData property. You can simply create a stream based on the available data:

MemoryStream ms = new MemoryStream(image.BinaryData);