title: Unable to load shared library 'libgdiplus' or one of its dependencies while running lambda function
body: <p>I am writing an AWS Lambda function in .NET Core 3.1. I am using Aspose.slides library in the AWS Lambda function. I am publishing the AWS lambda function as docker on AWS. Lambda function successfully gets published but when i test the Lambda it gives me the following error:</p>
  <pre><code>Aspose.Slides.PptxReadException: The type initializer for 'Gdip' threw an exception.
  ---&gt; System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
  ---&gt; System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory
  at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr&amp; token, StartupInput&amp; input, StartupOutput&amp; output)
  at System.Drawing.SafeNativeMethods.Gdip..cctor()
  </code></pre>
  <p>Even though, i am installing the <code>libgdiplus</code> package from the docker file but i am still getting the above error.</p>
  <p>Docker file is:</p>
  <pre><code>FROM public.ecr.aws/lambda/dotnet:core3.1 AS base  
  
  FROM mcr.microsoft.com/dotnet/sdk:3.1 as build  
  WORKDIR /src  
  COPY [&quot;Lambda.PowerPointProcessor.csproj&quot;, &quot;base/&quot;]  
  RUN dotnet restore &quot;base/Lambda.PowerPointProcessor.csproj&quot;  
    
  WORKDIR &quot;/src&quot;  
  COPY . .  
  RUN apt-get update &amp;&amp; apt-get install -y libc6-dev
  RUN apt-get update &amp;&amp; apt-get install -y libgdiplus
  RUN dotnet build &quot;Lambda.PowerPointProcessor.csproj&quot; --configuration Release --output /app/build  
    
  FROM build AS publish  
  RUN dotnet publish &quot;Lambda.PowerPointProcessor.csproj&quot; \  
              --configuration Release \   
              --runtime linux-x64 \  
              --self-contained false \   
              --output /app/publish \  
              -p:PublishReadyToRun=true    
    
  FROM base AS final  
  WORKDIR /var/task  
  COPY --from=publish /app/publish .  
  CMD [&quot;Lambda.PowerPointProcessor::Lambda.PowerPointProcessor.Function::FunctionHandler&quot;]
  </code></pre>
  <p>Any help would be much appreciated.</p>