C# Read in a bmp image as binary -


I have no idea how to read an image as a binary image I am using the following lines , Although it keeps reading in the blank.

  filestream inf = new filestream (name.ToString (), FileMode.OpenOrCreate, FileAccess.ReadWrite); BinaryRedder Data = New Binary Reader (INF);  

Can anyone help?

It really depends on you. For example, if you want to read in the .bmp file and display it in the image box, then you can do something like:

(Assuming a picture box named Photo box 1)

  stream bmpstream = null; Var ofd1 = new openfileDialog (); If (ofd1.ShowDialog () == DialogResult.OK) {try {bmpstream = ofd1.OpenFile ()} if (bmpstream! = Null) {using (bmpstream) {pictureBox1.image = new bitmap (bmpstream); }}} Hold (Exception preceding) {MessageBox.Show ("Error: Can not read file." + Previous message); }}  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -