title: Return image through RESTful webservice
body: <p>I want to return an image through a web API call. What I am trying to do is get the image, resize the image, and then return it.  Here is my code...</p>
  
  <pre><code>public Image GetImage(string url)
  {
      WebClient wc = new WebClient();
      byte[] data = wc.DownloadData(url);
      MemoryStream memstream = new MemoryStream(data);
      Image img = Image.FromStream(memstream);
      img = resize(img, new System.Drawing.Size(100, 100));
  
      return img;
  }
  
  protected static System.Drawing.Image resize(System.Drawing.Image imgToResize, System.Drawing.Size size)
  {
      return (System.Drawing.Image)(new System.Drawing.Bitmap(imgToResize, size));
  }
  </code></pre>
  
  <p>And then ideally, I would like be able to do something like this through the html...</p>
  
  <pre><code>&lt;img src="http://localhost:23520/Image/GetImage?url=whatever" /&gt;
  </code></pre>
  
  <p>This obviously doesn't work. Is there any way I can get this image tag to display a image returned by the RESTful service?</p>