I made a program that generated images, then I copied the code to a new project, but the Bitmap declaration show's this error message:
Severity Code Description Project File Line Suppression State
Error CS1069 The type name 'Bitmap' could not be found in the namespace 'System.Drawing'. This type has been forwarded to assembly 'System.Drawing.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' Consider adding a reference to that assembly. Bubble_generation E:\Programok\Bubble_generation\Bubble_generation\Program.cs
I also tried adding the system.drawing.dll manually, but even that didn't work. Here's a screenshot: https://i.sstatic.net/9c5qR.jpg , and here's the code:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
namespace Bubble_generation
{
class Program
{
static void Main(string[] args)
{
Bitmap image = new Bitmap("input.png");
int r_mem = 0;
int g_mem = 0;
int b_mem = 0;
Color color_mem;
for (int w = 0; w < image.Width; w++)
{
for (int h = 0; h < image.Height; h++)
{
r_mem = image.GetPixel(w, h).R;
g_mem = image.GetPixel(w, h).G;
b_mem = image.GetPixel(w, h).B;
color_mem = Color.FromArgb(r_mem, r_mem, r_mem);
image.SetPixel(w, h, color_mem);
}
}
string time = System.DateTime.Now.ToString("HH_mm_ss");
image.Save("output_" + time + ".png");
}
}
}
If you are in console mode, you must add this framework assembly reference in the References
section of the project in the solution explorer:
System.Drawing