private void ExportEps(Mesh mesh, string filename, int width, bool compress) { var eps = new EpsImage(); eps.Export(mesh, filename, width); if (compress) { CompressFile(filename, true); } }
public static void Run() { Console.WriteLine("Running example SupportForEPSFormat"); string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); using (EpsImage epsImage = Image.Load(dataDir + "sample.eps") as EpsImage) { // check if EPS image has any raster preview to proceed (for now only raster preview is supported) if (epsImage.HasRasterPreview) { if (epsImage.PhotoshopThumbnail != null) { // process Photoshop thumbnail if it's present } if (epsImage.EpsType == EpsType.Interchange) { // Get EPS Interchange subformat instance EpsInterchangeImage epsInterchangeImage = epsImage as EpsInterchangeImage; if (epsInterchangeImage.RasterPreview != null) { // process black-and-white Interchange raster preview if it's present } } else { // Get EPS Binary subformat instance EpsBinaryImage epsBinaryImage = epsImage as EpsBinaryImage; if (epsBinaryImage.TiffPreview != null) { // process TIFF preview if it's present } if (epsBinaryImage.WmfPreview != null) { // process WMF preview if it's present } } // export EPS image to PNG (by default, best available quality preview is used for export) epsImage.Save(dataDir + "anyEpsFile.png", new PngOptions()); } } Console.WriteLine("Finished example SupportForEPSFormat"); }
private void menuFileExport_Click(object sender, EventArgs e) { if (mesh != null) { FormExport export = new FormExport(); string file = settings.OfdDirectory; if (!file.EndsWith("\\")) { file += "\\"; } file += settings.CurrentFile; export.ImageName = Path.ChangeExtension(file, ".png"); if (export.ShowDialog() == DialogResult.OK) { int format = export.ImageFormat; int size = export.ImageSize; if (format == 1) { EpsImage eps = new EpsImage(); eps.Export(this.mesh, export.ImageName, size); } else if (format == 2) { SvgImage svg = new SvgImage(); svg.Export(this.mesh, export.ImageName, size); } else { RasterImage img = new RasterImage(); img.ColorScheme = ColorManager.LightScheme(); img.Export(this.mesh, export.ImageName, size); } } } }