In .Net Core, System.Drawing.Common library is provided for image manipulation.
However, if you are hosting your .Net core app in Linux and you are referencing System.Drawing.Common, you may need to install some native dependencies first.
Scott Hanselman wrote a great article on this which you can find here.
Recently, we needed to deploy a .Net core image processing service hosted in in AWS Fargate. Our DevOps team set up a CI/CD pipeline where we can deploy the app into AWS Fargate simply by pushing our code to Git and configuring our docker file.
OneĀ obstacle I had was how do I installĀ the native libraries needed for image processing in the AWS Fargate container instance.
I tried to add a code snippet in the docker file to run the following commands but it did not work:
sudo apt install libc6-dev
sudo apt install libgdiplus
The answer is to add this following snippet into your Dockerfile:
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libc6-dev libgdiplus \
&& rm -rf /var/lib/apt/lists/*
Special shoutout to my great colleague, Kamlesh Bhatt, in helping us to sort this out.