/// <summary> /// Export to an image format /// </summary> public static void Export(GraphicVisual visual, int width, bool addMargin, out string message) { message = string.Empty; var saveDialog = new Microsoft.Win32.SaveFileDialog(); saveDialog.Filter = "ICO File (*.ico)|*.ico|SVG File (*.svg)|*.svg|SVGZ File (*.svgz)|*.svgz|PNG File (*.png)|*.png|JPG File (*.jpg)|*.jpg|TIFF File (*.tiff)|*.tiff|BMP File (*.bmp)|*.bmp|GIF File (*.gif)|*.gif|EPS File (*.eps)|*.eps"; var result = saveDialog.ShowDialog(); if (result == false) { return; } var fileExtension = Path.GetExtension(saveDialog.FileName).ToLower(); switch (fileExtension) { case ".svg": SvgExporter.ExportSvg(visual, width, saveDialog.FileName); break; case ".svgz": SvgExporter.ExportSvgz(visual, width, saveDialog.FileName); break; case ".ico": IcoExporter.ExportIco(visual, saveDialog.FileName); break; case ".eps": { var exporter = new EpsExporter(); exporter.Export(visual, width, saveDialog.FileName, out message); break; } default: ImageExporter.ExportImage(visual, width, addMargin, saveDialog.FileName); break; } }