在Windows应用程序中将图像转换为二进制并将二进制转换为图像 [英] converting image to binary and binary to image in windows application full of code

查看:115
本文介绍了在Windows应用程序中将图像转换为二进制并将二进制转换为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请任何人知道转发给我,请立即执行此任务...我的mai id<已删除电子邮件=">或在adv

pls i need this task immediately if any body know forward to me pls...my mai id <removed e-mail=""> or to code project..thank u in adv

推荐答案


中对项目进行编码.
请阅读这篇文章
图像到二进制的转换

C#中的图像:保存,调整大小和转换到二进制文件

问候
AR
Hi,

Please go through with this article
Image to Binary conversion

Image in C#: Save, Resize, and Convert to Binary

Regards
AR


此处是将图像转换为...的功能.
Here is the function for the conversion of the image into either....
public byte[] ReadFile(string ImagePath)
       {
           byte[] Image_Binary_data = null;
           FileInfo FInfo = new FileInfo(ImagePath);
           long numBytes = FInfo.Length;
           FileStream FStream = new FileStream(ImagePath, FileMode.Open, FileAccess.Read);
           BinaryReader BR = new BinaryReader(FStream);
           Image_Binary_data = BR.ReadBytes((int)numBytes);
           return Image_Binary_data;
       }




现在将图像转换为二进制....




now converting the image into binary....

//Image_Con is the object of the class...
byte[] ImageFile = Image_Con.ReadFile(txt_path.Text);
pre>

now converting the binary into image....
<pre>byte[] ImageData = binary_image_stored_in_database;

            Image NewImage;
            using (MemoryStream MS = new MemoryStream(ImageData, 0, ImageData.Length))
            {
                MS.Write(ImageData, 0, ImageData.Length);
                NewImage = Image.FromStream(MS, true);
            }

            pic_image.Image = NewImage;



这就是全部...



This is all...


这篇关于在Windows应用程序中将图像转换为二进制并将二进制转换为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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