影像转换 [英] Image Conversion

查看:101
本文介绍了影像转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已将图像URL存储在表中,并在"image11"中检索它(如下所示)

字符串image11 = ds.Tables [0] .Rows [ctrl] [4] .ToString();

建议对图像进行一些转换(例如:对于字符串"ToString()")

sbtn.Image =(Image)(E:/ICON/ADD);//不工作

sbtn.Image =(..............).ToString; //不工作

sbtn.Image = image11.ToString//不起作用

Hi,
I have stored my image URL in table and retriving it in "image11"(shown below)

string image11 =ds.Tables[0].Rows[ctrl][4].ToString();

suggest some conversions for image(ex: for string ''ToString()'')

sbtn.Image = (Image)(E:/ICON/ADD);// NOT WORKING

sbtn.Image=(..............).ToString; // NOT WORKING

sbtn.Image = image11.ToString // NOT WORKING

推荐答案

尝试以下方法:

Try this one:

sbtn.Image =Image.FromFile(image11);



祝你好运



good luck


嘿,

您是否将整个图像字节存储到数据库中?

如果是这样,只需使用

Hey,

Are you storing the entire image byte into database?

If so, just use

byte[] byteArrayIn = Encoding.UTF8.GetBytes(imagebyte)
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;



如果要将URL存储在数据库中,请使用



If you are storing the url on the database use

string uri = ds.Tables[0].Rows[ctrl][4].ToString();
Image.FromFile(uri);


U可以尝试将img转换为字节,然后将其存储.
U can Try to convert the img to Bytes and then store it.


这篇关于影像转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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