hello every one. am trying to create Image from byte array in my page. First i create the image by System.Drawing.Image then am trying to convert

System.Drawing.Image

to

System.Web.UI.WebControls.Image

. but the compiler says "Cannot convert type 'System.Drawing.Image' to 'System.Web.UI.WebControls.Image'". So any one please help me.Thxs.

Sorry! but is it in Windows application or web-based application? If you want to convert it to array of bytes so...

System.Drawing.Image img;
....//any operation on img instance
....//any operation on img instance
....//any operation on img instance
System.IO.FileStream fs = new System.IO.FileStream(imagePath, System.IO.FileMode.Open);
img.Save(fs);
byte[] imageAsBytes = new byte[fs.Length];
fs.Read(imageAsBytes, 0, imageAsBytes.Length);
fs.Close();
//imgaeAsBytes is array of Byte to your image
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.