PlatformNotSupportedException: System.Drawing.Common Is Not Supported on This Platform

I have a .NET 9 ASP.NET Web API application running in a Linux container in Azure Kubernetes Services. It uses Aspose.Drawing, Aspose.Imaging, Aspose.Slides.NET all version 25.4.0. It also uses Apose.Pdf.Drawing version 25.3.0.

It is throwing this exception:-

PlatformNotSupportedException: System.Drawing.Common is not supported on this platform.

The exception happens on this line:-

IImage image = slide.GetImage(2.0f, 2.0f);

The 3 lines of relevant code are:-

using var presentation = new Presentation(pptStream);
ISlide slide = presentation.Slides[pageIndex];
IImage image = slide.GetImage(2.0f, 2.0f);

My Dockerfile includes these lines:-

RUN apt-get update && \
    apt-get install -y libgdiplus && \
    cd /usr/lib && ln -s libgdiplus.so gdiplus.dll

RUN apt-get install -y --no-install-recommends libc6-dev

I expected this to work on Linux because I am including the Aspose.Drawing NuGet package and including libgdiplus in the deployment but clearly it is failing because it is trying to use the Windows-only System.Drawing.Common.

Any ideas why?

@gsf42,
Thank you for contacting free support. We are sorry that you encountered this problem.

Please note the following:

I hope this information will help you.

More details:
System Requirements|Aspose.Slides Documentation
Aspose.Slides for .NET 6 Cross Platform|Aspose.Slides Documentation

If the issue persists, please share the following additional information:

  • OS distribution and version used in your Docker container
  • GLIBC version used in the operating system

Thank you for your answer. This is resolved now. I downloaded the ZIP file and used those files instead of the NuGet package.

@gsf42,
We are glad that the issue has been resolved on your end. Thank you for using Aspose.Slides for .NET.