Following example shows how to take the byte representation of an image.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace WebApplication2
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strPhoto = (@"C:\\Webcam.jpg");
FileStream fs = new FileStream(strPhoto, FileMode.Open, FileAccess.Read);
Byte[] imgByte = new byte[fs.Length];
fs.Read(imgByte, 0, System.Convert.ToInt32(fs.Length));
}
}
}
source reference from :
http://blogs.msdn.com/b/vijay/archive/2007/07/20/how-to-convert-image-into-byte-and-byte-to-image-using-c-in-asp-net.aspx
http://www.codeproject.com/Articles/15460/C-Image-to-Byte-Array-and-Byte-Array-to-Image-Conv
How to convert image into byte[] and byte[] to image using C# in ASP.NET
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace WebApplication2
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strPhoto = (@"C:\\Webcam.jpg");
FileStream fs = new FileStream(strPhoto, FileMode.Open, FileAccess.Read);
Byte[] imgByte = new byte[fs.Length];
fs.Read(imgByte, 0, System.Convert.ToInt32(fs.Length));
}
}
}
source reference from :
http://blogs.msdn.com/b/vijay/archive/2007/07/20/how-to-convert-image-into-byte-and-byte-to-image-using-c-in-asp-net.aspx
http://www.codeproject.com/Articles/15460/C-Image-to-Byte-Array-and-Byte-Array-to-Image-Conv
Comments
Post a Comment