简体   繁体   中英

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?

        }
    }
}

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

将System.Drawing.dll作为引用程序集添加到项目中。

包括System.Drawing.dll参考1)你可以从http://www.dllme.com/dll/download/7139/System.Drawing.dll下载它

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM