If you have this problem or you can't make casting convert Image to Byte Array in dotNet Solution, you can follow bellow:
[WRONG]
return (Byte[])imgLogoBuffer;[RIGHT]
Byte[] btImageLogo = new Byte[1];[RIGHT]
return btImageLogo = (Byte[])(new ImageConverter()).ConvertTo(imgLogoBuffer, btImageLogo.GetType());
بابا جان هر چی رو که نمی شه با cast کردن تبدیل کرد. راه حل بالا بد نیست. گرچه راه زیاد است برای رسیدن به بایت های یک تصویر
Imagine the power of tens of thousands of other web sites being able to easily
ReplyDeleteError: Cannot convert type 'byte[]' to 'System.Drawing.Image'
ReplyDelete//byte[] btImageLogo;
Image img = Image.FromStream(new MemoryStream(btImageLogo));
good job :P
ReplyDelete