G
Guest
I'd like to send a bitmap image to my webservice and the prevailing logic for
desktop apps seems to be to prepare a byte array like this:
Image img = new Bitmap(@"C:\photo.jpg");
MemoryStream ms = new MemoryStream();
img.Save(ms, ImageFormat.Jpeg);
byte[] imgbytes = ms.GetBuffer();
webservice.PutPhoto(imgbytes);
Unfortunately on Compact Framework an Image doesn't seem to have a Save
method. Is there a simple way to turn a bitmap into a byte array with other
classes, or do I just have to read in the bytes from disk myself?
desktop apps seems to be to prepare a byte array like this:
Image img = new Bitmap(@"C:\photo.jpg");
MemoryStream ms = new MemoryStream();
img.Save(ms, ImageFormat.Jpeg);
byte[] imgbytes = ms.GetBuffer();
webservice.PutPhoto(imgbytes);
Unfortunately on Compact Framework an Image doesn't seem to have a Save
method. Is there a simple way to turn a bitmap into a byte array with other
classes, or do I just have to read in the bytes from disk myself?