Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用xamarin表单将iphone应用程序的图像转换为字节_C#_Ios_Iphone_Xamarin.forms - Fatal编程技术网

C# 使用xamarin表单将iphone应用程序的图像转换为字节

C# 使用xamarin表单将iphone应用程序的图像转换为字节,c#,ios,iphone,xamarin.forms,C#,Ios,Iphone,Xamarin.forms,我想将图像转换为字节以便服务器上载。所以,我使用了下面的代码,这是抛出错误。谁能帮帮我吗 错误:“对类型'system.componentmodel.typeconverter'的引用” 声称它是在装配系统中定义的,但找不到它” Xamarin表单映像与System.Drawing.Image不同。System.Drawing.Image是W32类,在Xamarin中不存在。您不能将XF映像转换为字节[]。相反,您需要引用创建映像时使用的任何资源(文件、流、url等),并使用这些资源创建字节[]

我想将图像转换为字节以便服务器上载。所以,我使用了下面的代码,这是抛出错误。谁能帮帮我吗

错误:“对类型'system.componentmodel.typeconverter'的引用” 声称它是在装配系统中定义的,但找不到它”


Xamarin表单映像与System.Drawing.Image不同。System.Drawing.Image是W32类,在Xamarin中不存在。您不能将XF映像转换为字节[]。相反,您需要引用创建映像时使用的任何资源(文件、流、url等),并使用这些资源创建字节[].

Xamarin表单映像与System.Drawing.Image不同。System.Drawing.Image是W32类,在Xamarin中不存在。您不能将XF映像转换为字节[]。相反,您需要引用用于创建映像的任何资源(文件、流、url等),并使用这些资源创建字节[].

这是从iphone摄像头捕获的图像。那么,转换的最佳方式是什么?这是从iphone摄像头捕获的图像。那么,转换的最佳方式是什么?
public static byte[] imgToByteConverter(System.Drawing.Image inImg)
{
    ImageConverter imgCon = new ImageConverter();   
    return (byte[])imgCon.ConvertTo(inImg, typeof(byte[]));        
}