| | |
Sending Bitmap using WCF
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2007
Posts: 30
Reputation:
Solved Threads: 0
Hi,
I'm trying to send a bitmap using WCF and here's the steps i followed:
1-Convert it into byte array
2-Receiving the byte array from the other client side and convert it into bitmap to display it
i don't know why pictureBox.Image is always black...it doesn't display the image,although the "hello.bmp" file on the hard disk changes while catching the picture.
N.B the byte array "Data" isn't set to null it contains the values i sent from the other client side.
I'm trying to send a bitmap using WCF and here's the steps i followed:
1-Convert it into byte array
C# Syntax (Toggle Plain Text)
private IDataObject tempObj; private System.Drawing.Image tempImg; tempObj = Clipboard.GetDataObject(); tempImg = (System.Drawing.Bitmap)tempObj.GetData(System.Windows.Forms.DataFormats.Bitmap); tempImg.Save("hello.bmp"); VideoData = System.IO.File.ReadAllBytes("hello.bmp");
C# Syntax (Toggle Plain Text)
public void ReceiveByteArray(byte[] Data) { try { TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap)); Bitmap bitmap1 = (Bitmap)tc.ConvertFrom(Data); pictureBox2.Image = bitmap1; } catch (Exception ex) { MessageBox.Show(ex.Message); }
i don't know why pictureBox.Image is always black...it doesn't display the image,although the "hello.bmp" file on the hard disk changes while catching the picture.
N.B the byte array "Data" isn't set to null it contains the values i sent from the other client side.
If you saved this bitmap on client's HDD, what the result, also black?
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Check if your array comes in order or not.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
•
•
Join Date: Oct 2007
Posts: 30
Reputation:
Solved Threads: 0
Yes it comes in order and everything is okay...it was a matter of format.
Thanks for help
C# Syntax (Toggle Plain Text)
private void WebCamCapture_ImageCaptured(object source, WebcamEventArgs e) { // set the picturebox picture MemoryStream ms = new MemoryStream(); e.WebCamImage.Save(ms, ImageFormat.Jpeg); proxy.SendShot(new SimpleSvc.VideoChat(ms.ToArray(),lstContacts.SelectedItem.ToString())); this.pictureBox1.Image = e.WebCamImage; }
![]() |
Other Threads in the C# Forum
- Previous Thread: Image Plotting Problem
- Next Thread: decimal to hexadecimal
| Thread Tools | Search this Thread |
.net access algorithm array asp.net barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net httpwebrequest image index input install java label libraries list listbox loop mandelbrot marshalbyrefobject math mouseclick movingimage mysql mysql.data.client operator path photoshop picturebox pixelinversion platform post programming radians regex remote remoting resourcefile richtextbox server sleep socket sql statistics stream string system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf wpfc# xml






