This post is about applying Watermark images on the fly in ASP.NET Core. From the initial days of ASP.NET Core image manipulation was a challenge since the System.Drawing library was depend on GDI+ and Microsoft didn’t released a package for image manipulation.
In this post I am using CoreCompat.System.Drawing package, it implementation of System.Drawing which is compatible with .NET Core. It uses the Mono implementation of System.Drawing and runs on Windows, Linux and Mac. If use System.Drawing for .NET Core on OS X or Linux, make sure you reference the native packages: Linux: runtime.linux-x64.CoreCompat.System.Drawing and OS X: runtime.osx.10.10-x64.CoreCompat.System.Drawing
Here is the project.csproj file.
And here is the code, which will add the watermark to any image.
And here is the watermarked image.
Happy Programming :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.