|
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.
|
|
|
|
|
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
regards
|
|
|
|
|
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'));
}
DaveBTW, 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)
|
|
|
|
|
how to perform an action against the mouse click on the header of the c#asp.net gridview's column.
|
|
|
|
|
U can get that in Javascript
This code needs to be registered on page load.
TableObject.rows[0].onclick = Function("return YourFunctionName(this);");
Here
TableObject is ur gridview object
rows[0] gives the first row that is the header row.
Then write ur logic in "YourFunctionName"
Regards
Santhosh N
|
|
|
|
|
Help me....
I am new in c# application. i want to Control memory leak and
not exceed 30mb in Task manager memory status.now in our application
the memory status is 42mb. memory size will rise if open a new GUI.
But the memory size suddenly low up to 5~10mb if minimize that GUI.
why these are happened. And how can handle this.
where i written That( Garbage collection) code. please give
all details and articles path.
Hope..
Thankyou.
|
|
|
|
|
Hey Anish,
If you can give more details like what controls are you using or any specific code that you suspect to be the culprit , because its hard to find out any thing on the information you have mentioned , the information is too generic , to think of a solution
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Thank you for replay
here we are used, the database interact with GUI. and
used DirectXCapture dll for recording a file in wma format. so two thread are
run concurrently.
But we used lot of GUI Component.
|
|
|
|
|
http://www.itwriting.com/dotnetmem.php[^]
Task manager does give an accurate picture of how much memory your app is using. Use Perfmon as described in the article.
Cheers,
Vıkram.
I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends.
- Josh Gray.
|
|
|
|
|
Vikram A Punathambekar wrote: Task manager does give an accurate picture of how much memory your app is using.
You forgot the "not" in "Task manager does not give an accurate picture of how much memory your app is using.".
Despite everything, the person most likely to be fooling you next is yourself.
modified on Tuesday, January 27, 2009 7:41 PM
|
|
|
|
|
Whoops! You have a sharp eye, thanks!
Cheers,
Vıkram.
I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends.
- Josh Gray.
|
|
|
|
|
anishkannan wrote: I am new in c# application. i want to Control memory leak and not exceed 30mb in Task manager memory status.
As mentioned in the thread, the task manager does not give you an accurate measure of the amount of memory used.
As you are new to C# you are probably new to how the .NET memory management works. It allocates more memory if needed, but does not return it just because it's unused at the moment, but rather when the system needs it.
A system doesn't run better from having a lot of unused memory. On the contrary, trying to minimise the memory usage when there is no need for the memory is just unnecessary work for the system.
anishkannan wrote: now in our application the memory status is 42mb. memory size will rise if open a new GUI.
But the memory size suddenly low up to 5~10mb if minimize that GUI.
That is perfectly normal. When you minimise the application, the system sends a signal to it to try to free up some unused memory.
anishkannan wrote: And how can handle this.
It doesn't need handling. The memory management in .NET takes care of it all.
anishkannan wrote: where i written That( Garbage collection) code.
Don't mess with the garbage collector unless you really have an actual memory management problem. That is quite rare, and your situation is definitely not it.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi all,
I am trying to create a XML using DataSet.WriteXml.
The XML was created, but its not creating any node for NULLs.
I also tried by query
"SELECT (SELECT * FROM TBL_NAME FOR XML AUTO, ELEMENTS XSINIL) "
but the out put structure was changed. For bulk copy to SQL its not supporting due the columnnames were not matching.
Please suggest me how to create a XML including NULLs.
Thanks in advance.
|
|
|
|
|
Dunno, I've never used DataSet.WriteXml; for that matter, I rarely use a DataSet.
I suggest using an XmlDocument or XmlTextWriter to create XML files.
What I generally do for nulls is have an IsNull attribute that I can set:
<SomeValue IsNull="false" >blah</SomeValue>
<SomeValue IsNull="false" />
<SomeValue IsNull="true" />
|
|
|
|
|
Hello all,
i have the requirement to Extract data from image. can u plz help me out with the code.
I am strugling to extract data from image file using C# (.net 2.0)
For Ex: I have an image with a number.. I need process the image and extract the number and store it in sql DB.
Please help me for this implementation using C#.
Thanks
|
|
|
|
|
What kind of extraction are you talking about?
If it's simply a number presented as an image, google for OCR libraries. If the data is hidden in your images, google for steganography. Also, Corinna John has an excellent set of articles on the latter, here at CodeProject.
Cheers,
Vıkram.
I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends.
- Josh Gray.
|
|
|
|
|
|
I need to extract the text from image file. The image file may contain text embedded with the image.
|
|
|
|
|
Did you actually read the post you just replied to? He told you what you need to do, and even posted useful links!
|
|
|
|
|
i want to change the background color of an image in that way that only visible part get new background color, is there any in built function for this ? well, i tried with this but i dont know what to do next
Bitmap bmp = new Bitmap("C:\abc.png");
for (int x = 0; x < bmp.Width; x++)
{
for (int y = 0; y < bmp.Height; y++)
{
Color tmp_oldColor = bmp.GetPixel(x, y);
if (tmp_oldColor != Color.Transparent)
{
Color tmp_newColor = ??;
tmp_newColor.A = tmp_oldColor.A;
bmp.SetPixel(x, y, tmp_newColor);
}
}
}
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
As you are not using the transparency to determine background color, what do you want the background color to be?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hmmm....my mistake, i wrote "change". The actual thing is that the image is transparent, like vista glass and but have some shapes on it those are tranparent too and i want to set its backcolor, like green, blue or any. That my question.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Ok, create a new bitmap with the same size, create a graphics object for it using Graphics.FromImage, fill the image with the background image using the Clear method and draw your image on it using the DrawImage method.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
No, you misunderstood, here is some example
Transparent Image
Added Red Back Color
now see the last image, i added color red but i just want color back to the image, not in entire image
i can do something nearly, Fill a rectangle with Red color, draw image then use MakeTransparent(Color.Red) but it wont do exactly what i want, it will not set alpha. My image wont be transparent anymore.
the otherway i can use is : (just wrote directly, not tested)
Bitmap bmp = new Bitmap(ofd.FileName);
Bitmap bmp_backColor = new Bitmap(bmp.Width, bmp.Height);
for (int x = 0; x < bmp.Width; x++)
{
for (int y = 0; y < bmp.Height; y++)
{
Color tmp_oldColor = bmp.GetPixel(x, y);
if (tmp_oldColor != Color.Transparent)
{
Color tmp_newColor = Color.FromArgb(tmp_oldColor.A, 255, 0, 0);
bmp_backColor.SetPixel(x, y, tmp_newColor);
}
}
}
Graphics m_gr = Graphics.FromImage(bmp_backColor);
m_gr.DrawImage(bmp, 0, 0, bmp.Width, bmp.Height);
m_gr.Dispose();
pictureBox1.BackgroundImage = bmp_backColor;
Is this way right ?
Modified :
I updated the code with working one,
The Working Output
My question, is that the only way or is that way good ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
modified on Tuesday, January 27, 2009 4:21 AM
|
|
|
|
|
Xmen wrote: Color tmp_newColor = ??; // how to get new color ? Multiply, Add ?
Color tmp_newColor = Color.Green;
or Color.FromArgb(....)
or Color.FromName(...)
or Color.FromKnownName(...)
choose whatever...
HTH
[Modified]
one more thing, you are using GetPixel and SetPixel which are extremely slow. try using LockBits() and UnlockBits() for speed.
[/Modified]
regards
|
|
|
|