简体   繁体   English

在控制台应用程序中创建图像或位图 - 似乎无法找到System.Drawing?

[英]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. 我正在尝试从相机比特流创建一个图像或位图,我将(希望)通过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. 我正在构建的应用程序是一个控制台应用程序,因为我认为这个应用程序不需要有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. 现在我在创建/访问Image和Bitmap类时遇到了麻烦 - System.Drawing似乎不存在,我不知道为什么。 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? 当我尝试using System.Drawing我得到错误The type or namespace name 'Drawing' does not exist in the namespace 'System' (are you missing an assembly reference?)在控制台应用程序中创建位图的最佳方法是什么The type or namespace name 'Drawing' does not exist in the namespace 'System' (are you missing an assembly reference?)有没有理由我似乎无法加载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. 您必须在项目中添加对system.Drawing.Dll的引用。

Right click on Project, add reference and find System.Drawing.DLL and add reference. 右键单击Project,添加引用并查找System.Drawing.DLL并添加引用。

EDIT: You will find it under Assemblies->Framework->System.Drawing 编辑:您将在Assemblies-> Framework-> System.Drawing下找到它

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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