Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create Image or Bitmap in console application - can't seem to find System.Drawing?

I'm trying to create an image or bitmap from a camera bitstream that I will be (hopefully) passing to the browser via a websocket. The application I'm building is a console app as I didn't think there would be a need for this app to have a GUI. Now I'm having trouble creating/accessing Image and Bitmap classes - System.Drawing doesn't seem to exist and I'm not sure why. When I try using System.Drawing I get the error The type or namespace name 'Drawing' does not exist in the namespace 'System' (are you missing an assembly reference?) What's the best way to create a bitmap in a console application, and is there a reason I seem to be unable to load System.Drawing?

Code:

private void Kinect_ColorFrameReady(object sender, ColorImageFrameReadyEventArgs e)
{
    using (ColorImageFrame frame = e.OpenColorImageFrame())
    {
        if (frame != null)
        {
            byte[] pixelData = new byte[frame.PixelDataLength];
            frame.CopyPixelDataTo(pixelData);
            //how do we create a bitmap here and pass it off to chrome?

        }
    }
}
like image 934
HowDoIDoComputer Avatar asked Dec 09 '12 04:12

HowDoIDoComputer


2 Answers

You have to add Reference to the system.Drawing.Dll in your project.

Right click on Project, add reference and find System.Drawing.DLL and add reference.

EDIT: You will find it under Assemblies->Framework->System.Drawing

like image 85
Moiz Avatar answered Oct 16 '22 00:10

Moiz


Add System.Drawing.dll as reference assembly to your project.

like image 28
Igor Avatar answered Oct 16 '22 00:10

Igor