the easy way to convert any image to string is :
1- Convert Image to Memory Stream.
2- Convert Memory Stream to Base64String.
so in this sample code I will convert the image to string and I'll save this string in text file.
private string ConvertImage(Bitmap sBit)
{
MemoryStream imageStream = new MemoryStream();
sBit.Save(imageStream, ImageFormat.Jpeg);
return Convert.ToBase64String(imageStream.ToArray());
}
private void button1_Click(object sender, EventArgs e)
{
Bitmap sBit = new Bitmap(@"C:\bmw.jpg");
string imageString = ConvertImage(sBit);
StreamWriter sw = new StreamWriter(@"C:\waleedelkot.text", false);
sw.Write(imageString);
sw.Close();
}
dear sir can u work for me
ReplyDeletei can pay u a lot
my gmail id is uday.binny@gmail.com
i am working in data processing, i need a developer like u
Hi, How can i get this to a string array?
ReplyDeleteit's only converting the bits into pexils,
ReplyDeletenot charaters or image processing
please read more about OCR/ICR/OMR etc..
sir i have to prepare one project in .net.. in which i have to convert one jpg image(scan image) into text file.....
ReplyDeletecan u tell me the code for this?
pls help me
emailid :- pratibha.sharma9@gmail.com
That was really funny, actually more funny than sBit.ToString()
ReplyDelete