Skip to content

Instantly share code, notes, and snippets.

@jak
Created January 26, 2011 16:45
Show Gist options
  • Save jak/796979 to your computer and use it in GitHub Desktop.
Save jak/796979 to your computer and use it in GitHub Desktop.
Pictures over Web Services - Service side
[WebMethod]
public string GetPicture() {
// Load the picture
Image img = Image.FromFile("Path/To/Picture.jpg");
// Create a memory stream, and put the image contents into it.
MemoryStream stream = new MemoryStream();
img.Save(stream, img.RawFormat);
// return data, encoded in Base64
return Convert.ToBase64String(stream.ToArray());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment