如何将图像上的任何数据转换为二进制 [英] how to convert any data on image into binary

查看:107
本文介绍了如何将图像上的任何数据转换为二进制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑。请帮助我。

解决方案

请参阅此代码项目文章。我假设你想把行李数据转换成二进制数据。



C#图像到字节数组和字节数组到图像转换器类 [ ^ ]

 HttpRequestBase request = Request; 
if (request!= null && request.Files.Count > 0 && request.Files [ 0 ] = = null && request.Files [ 0 ]。ContentLength > 0
{
var file = request.Files [ 0 ];
if (file!= null
{
var path = Path.Combine(Server.MapPath( 〜/内容/图像),file.FileName);
file.SaveAs(path);
employee.UserImage = System.IO.File.ReadAllBytes(path);
}
}





...通过这种方式你可以转换并插入选定的图像路径


i m confuse.so please help me.

解决方案

See this Code project article. I assumed that you want to convert imgage data in to binary.

C# Image to Byte Array and Byte Array to Image Converter Class[^]


HttpRequestBase request = Request;
         if (request != null && request.Files.Count > 0 && request.Files[0] != null && request.Files[0].ContentLength > 0)
         {
             var file = request.Files[0];
             if (file != null)
             {
                 var path = Path.Combine(Server.MapPath("~/Content/images"), file.FileName);
                 file.SaveAs(path);
                 employee.UserImage = System.IO.File.ReadAllBytes(path);
             }
         }



...By This Way You Can Convert And Insert The Selected Image Path


这篇关于如何将图像上的任何数据转换为二进制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆