Reputation:
I'm looking at creating a small program in C# that takes in an image, crops it and spits out the cropped image as a new image.
I'm just getting started with the program and I'm having some errors regarding System.Drawing
and the Bitmap
data type.
I've declared a Bitmap object in main()
and receive this error:
So next thing I try is declaring using System.Drawing.Common;
. Doing so gives me this error:
I am serious stumped with what to do as I can't seem to find anything online. Any help would be amazing!
If it helps, I'm using Visual Studio Code to write my code and my OS is MacOS Catalina. I've also attached the full code file. Its not much but that's all I've got.
Thanks in advance!
using System;
using System.Drawing;
using System.Drawing.Common;
namespace consoleproject
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Bitmap bitmap = new Bitmap();
}
}
}
Upvotes: 0
Views: 1238
Reputation: 66
It seems you are missing the System.Drawing.Common package. It is not added by default in .Net core projects. To add it:
dotnet add package System.Drawing.Common
Upvotes: 1