public static Image dibujarGrafo(String grafo_en_DOT) { WINGRAPHVIZLib.DOT dot = new WINGRAPHVIZLib.DOT(); WINGRAPHVIZLib.BinaryImage img = dot.ToPNG(grafo_en_DOT); byte[] imageBytes = Convert.FromBase64String(img.ToBase64String()); MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length); ms.Write(imageBytes, 0, imageBytes.Length); Image imagen = Image.FromStream(ms, true); return(imagen); }
public static Image getImage(ParseTreeNode raiz) { String grafica = GenerarGrafica.GenerarEstructura(raiz); WINGRAPHVIZLib.DOT dot = new WINGRAPHVIZLib.DOT(); WINGRAPHVIZLib.BinaryImage img = dot.ToPNG(grafica); byte[] imageBytes = Convert.FromBase64String(img.ToBase64String()); MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length); Image imagen = Image.FromStream(ms, true); return(imagen); }
public static void GraficarArbol(String filename, String path) { String text = File.ReadAllText(HttpContext.Current.Server.MapPath("~/Arbol.txt")); WINGRAPHVIZLib.DOT dot = new WINGRAPHVIZLib.DOT(); WINGRAPHVIZLib.BinaryImage img = dot.ToPNG(text); byte[] imageBytes = Convert.FromBase64String(img.ToBase64String()); MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length); ms.Write(imageBytes, 0, imageBytes.Length); Image imagen = Image.FromStream(ms, true); imagen.Save(HttpContext.Current.Server.MapPath("~/Arbol.png")); }