Bitmap Image Processing Using C#
-
Hi, I want to read the Bitmap Image using C# and i'm trying to display these image in 0's and 1's please help me to solve the problem. :(( :confused:
-
Hi, I want to read the Bitmap Image using C# and i'm trying to display these image in 0's and 1's please help me to solve the problem. :(( :confused:
karthick sampangi wrote:
I want to read the Bitmap Image using C#
use LockBits() to obtain the bitmat data.
karthick sampangi wrote:
i'm trying to display these image in 0's and 1's
good luck :thumbsup:
regards :)
-
Hi, I want to read the Bitmap Image using C# and i'm trying to display these image in 0's and 1's please help me to solve the problem. :(( :confused:
The first thing you need to do is get a byte[] (byte array) of the image. You can use BitmapData from the LockBits as suggested before, or possibly save the bitmap to a MemoryStream and get the byte array from the stream. Getting the binary display is then trivial, just use Convert.ToString on each byte:
foreach (byte index in byteArray)
{
Console.WriteLine(Convert.ToString(index, 2).PadLeft(8, '0'));
}Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)