Native Image not found help
-
I'm creating a simple remoting application on images and this is how my program goes. There's a server and there's a client and there's this DLL file that they commonly use so that they can communicate to each other remotely... The server contains the images. So when the client is executed, it contacts the server to get a specific image. So the request is successfuly sent to the server. The server found the image so it made use of the "Image theImage = Image.getFromFile('etc. etc.')" function.. it was successful, (i'm assuming the image now is in the "theImage" variable)... so the next thing the server to do now is to send the image back to the client to be displayed on a picture box... then BAAMM!! then the error popped out on the client side that "Native Image Not Found". How do i resolve this?
-
I'm creating a simple remoting application on images and this is how my program goes. There's a server and there's a client and there's this DLL file that they commonly use so that they can communicate to each other remotely... The server contains the images. So when the client is executed, it contacts the server to get a specific image. So the request is successfuly sent to the server. The server found the image so it made use of the "Image theImage = Image.getFromFile('etc. etc.')" function.. it was successful, (i'm assuming the image now is in the "theImage" variable)... so the next thing the server to do now is to send the image back to the client to be displayed on a picture box... then BAAMM!! then the error popped out on the client side that "Native Image Not Found". How do i resolve this?
You'll want to be sending that image as a stream, then recreating a bitmap from that stream. It's quit simple really:
[server]
Bitmap img = new Bitmap(@"path");
Stream myStream = new MemoryStream();
img.Save(myStream, ImageFormat.Bmp);
...
[client]
Bitmap img = new Bitmap(myStream);If this is what you'r already doing then err... I don't know. Sorry.
My current favourite word is: Nipple!
-SK Genius
-
You'll want to be sending that image as a stream, then recreating a bitmap from that stream. It's quit simple really:
[server]
Bitmap img = new Bitmap(@"path");
Stream myStream = new MemoryStream();
img.Save(myStream, ImageFormat.Bmp);
...
[client]
Bitmap img = new Bitmap(myStream);If this is what you'r already doing then err... I don't know. Sorry.
My current favourite word is: Nipple!
-SK Genius
-
I'm creating a simple remoting application on images and this is how my program goes. There's a server and there's a client and there's this DLL file that they commonly use so that they can communicate to each other remotely... The server contains the images. So when the client is executed, it contacts the server to get a specific image. So the request is successfuly sent to the server. The server found the image so it made use of the "Image theImage = Image.getFromFile('etc. etc.')" function.. it was successful, (i'm assuming the image now is in the "theImage" variable)... so the next thing the server to do now is to send the image back to the client to be displayed on a picture box... then BAAMM!! then the error popped out on the client side that "Native Image Not Found". How do i resolve this?
You can try out this. In Server, 1. Read the image from the file. 2. Save the image onto a MemoryStream object. 3. Get the buffer from the MemoryStream using GetBuffer() method, this method will return the bytes from the memory stream. Now you send this byte array to the client. Now In Client, 1. Create new MemoryStream object and write the byte array received from server onto the MemoryStream. 2. Create new Image object from the MemoryStream using Image.FromStream() method and use this image object in the PictureBox.
Do more work Make more mistakes Learn more things