According to the docs, there's supposed to be a class for thumbnail handling in the namespace System.Drawing
. I want to create a model that has an image as a property and then save it to a database. However, when I try the code below, I get an error that the class isn't found in that namespace, regardless of the docs stating otherwise.
using System.Drawing;
public class Donkey
{
public Image Image { get;set; }
}
What am I missing?!
I've googled it but only found old posts and examples that seem not to work.
Try installing the System.Drawing.Common
NuGet package. This contains Image
and other related types like Bitmap
.
PM> Install-Package System.Drawing.Common
You can also install using the NuGet Package Manager UI accessible by right-clicking the solution in Solution Explorer and choosing Manage NuGet Packages...
Adding a clarification comment from @KonradViltersten:
Traditionally,
System.Drawing
was included in the full .NET Framework, but not .NET Core becauseSystem.Drawing
was based on Windows drawing methods. .NET core was designed to be platform independent and thus did not include anything that was platform specific (like drawing). Because this functionality is so requested, MS released a separate assembly that could be installed to provide the functionality
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With