public ActionResult GetMacaroniImage() { var data = GetMacaroniData(); Image img = StcGraphics.GetMacaroniGraph2D(data, 12, 14, 0F, 10F, Color.Plum, Color.LightSeaGreen, true); using (var ms = new MemoryStream()) { img.Save(ms, ImageFormat.Jpeg); return(File(ms.ToArray(), "image/jpeg")); } }
public HttpResponseMessage GetMacaroniImage(string userToken, string culture = "en") { var data = GetMacaroniData(userToken, culture); Image img = StcGraphics.GetMacaroniGraph2D(data, 12, 14, 0F, 10F, Color.Plum, Color.LightSeaGreen, true); using (var ms = new MemoryStream()) { img.Save(ms, ImageFormat.Jpeg); var result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new ByteArrayContent(ms.ToArray()); result.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("image/jpeg"); return(result); } }