Convert JPG to EPS using API for .NET

Overview

This article explains how to convert JPG to EPS using C#. It covers the following topics.

C# Image to EPS

The Image to EPS conversion using C# from other formats like BMP, TIFF, PNG etc. are covered in these articles.

C# JPG to EPS Conversion

You can check the quality of Aspose.Page JPG to EPS conversion and view the results via free online JPG to EPS Converter and than view the resulting EPS file with our EPS Viewer


Aspose.Page for .NET JPG to EPS converter allows to convert JPG image to Encapsulated PostScript (EPS) file with using of any language supported by .NET platform: C#, VB, J#.

Steps: JPG to EPS Converter API Code in C#

It is necessary to do just 2 steps in order to perform JPG to EPS conversion:

  1. Create an instance of PsSaveOptions.
  2. Use static method SaveImageToEps of PsDocument.

SaveImageToEps method has four modifications to provide a user with the most comfortable way to save JPG image to EPS.

Using strings for saving JPG to EPS in C#

In the following C# code snippet the input image and the output EPS file are assigned by strings:

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
 2
 3// The path to the documents directory.
 4string dataDir = GetDataDir();
 5
 6// Create default options
 7PsSaveOptions options = new PsSaveOptions();
 8
 9// Save JPG image to EPS file
10PsDocument.SaveImageAsEps(dataDir + "input1.jpg", dataDir + "output1.eps", options);

Using streams for saving JPG to EPS in C#

In the following C# code snippet input image and output EPS file are assigned by streams:

1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
2
3// Create default options
4PsSaveOptions options = new PsSaveOptions();
5
6// Save JPG image to EPS file
7PsDocument.SaveImageAsEps(inputStream, outputStream, options);

Using Bimap object and string for saving JPG to EPS in C#

In the following C# code snippet input image is assigned by Bitmap object and the output EPS file is assigned by string:

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
 2
 3// The path to the documents directory.
 4string dataDir = GetDataDir();
 5
 6// Create default options
 7PsSaveOptions options = new PsSaveOptions();
 8// Create the bitmap object from image file
 9using(Bitmap jpg = new Bitmap(File.OpenRead(dataDir + "input1.jpg")))
10{
11	// Save JPG image to EPS file
12	PsDocument.SaveImageAsEps(jpg, dataDir + "output1.eps", options);
13}

Using Bimap object and stream for saving JPG to EPS in C#

In the following C# code snippet input image is assigned by Bitmap object and the output EPS file is assigned by stream:

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
 2
 3// The path to the documents directory.
 4string dataDir = GetDataDir();
 5
 6// Create default options
 7PsSaveOptions options = new PsSaveOptions();
 8// Create the bitmap object from image file
 9using(Bitmap jpg = new Bitmap(File.OpenRead(dataDir + "input1.jpg")))
10{
11	// Create the output stream fo EPS file
12	using(Stream outputStream = File.OpenWrite(dataDir + "output1.eps"))
13	{
14		// Save JPG image to EPS file
15		PsDocument.SaveImageAsEps(jpg, outputStream, options);
16	}
17}

See JPG to EPS conversion in Java and C++.

Evaluate JPG to EPS conversion online on our JPG to EPS Converter. You can convert several JPG image to EPS files at once and dowload results in a few seconds.

You can download examples and data files from GitHub.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.