EPS (Encapsulated PostScript) is a graphics file format that is used to describe images or drawings. In various scenarios, EPS images are also used to be placed within another PostScript document. EPS contains an encapsulated low-resolution preview, however, you may come across the need of converting EPS images to a format that could easily be displayed without any dependency. For such cases, this article covers how to convert EPS to PNG or PDF using C#.
C# EPS to PNG or PDF Converter API
Aspose.Imaging for .NET is an image processing and manipulation API that lets you work with EPS images within your .NET applications. It provides easy to use methods to convert EPS files to PNG images or PDF documents seamlessly. You can either download API’s DLL or install it using NuGet.
PM> Install-Package Aspose.Imaging
EPS to PNG C# Conversion
Aspose.Imaging for .NET provides PngOptions class that allows you to control EPS to PNG conversion with different options. The following are the steps to convert an EPS image to PNG.
- Load the EPS file using Image.Load(String) method.
- Create an object of PngOptions class and set its options such as image’s height and width.
- Convert EPS to PNG using Image.Save(String, ImageOptionsBase) method.
The following code sample shows how to convert an EPS file to PNG using C#.
EPS to PNG
EPS to PDF C# Conversion
Similar to the PngOptions, Aspose.Imaging provides PdfOptions class for controlling EPS to PDF conversion. The following are the steps to convert an EPS image to a PDF.
- Load the EPS file using Image.Load(String) method.
- Create an object of PdfOptions class and set its options such as PDF compliance version.
- Convert EPS to PDF using Image.Save(String, ImageOptionsBase) method.
The following code sample shows how to convert EPS to PDF using C#.
EPS to PDF
Conclusion
In this article, you have learned how to convert EPS images to PNG or PDF format using C#. The step by step guide and code samples also showed how to customize EPS to PNG/PDF conversion using Aspose.Imaging for .NET. You can explore more about the API using the documentation.