Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active July 4, 2024 03:52
Show Gist options
  • Save aspose-com-kb/1cce34ec677cb32f5cb4448766e23812 to your computer and use it in GitHub Desktop.
Save aspose-com-kb/1cce34ec677cb32f5cb4448766e23812 to your computer and use it in GitHub Desktop.
Convert EPS to TIFF in C#. The steps of converting EPS to TIFF in C# are given in the following topic: https://kb.aspose.com/page/net/how-to-convert-eps-to-tiff-in-c-sharp/
using System;
using System.IO;
using System.Drawing.Imaging;
//Add reference to Aspose.Page for .NET API
//Use following namespace to convert EPS to TIFF file type
using Aspose.Page;
using Aspose.Page.EPS;
using Aspose.Page.EPS.Device;
namespace ConvertEPSToTIFF
{
class Program
{
static void Main(string[] args)
{
//Set Aspose license before converting EPS to TIFF type
//using Aspose.Page for .NET
Aspose.Page.License AsposePageLicense = new Aspose.Page.License();
AsposePageLicense.SetLicense(@"c:\asposelicense\license.lic");
FileStream InputEPSFileToBeConverted = File.Open("EPSFileToBeConverted.eps", FileMode.Open, FileAccess.Read);
PsDocument InputEPSDocument = new PsDocument(InputEPSFileToBeConverted);
ImageDevice TiffImageDevice = new ImageDevice(ImageFormat.Tiff);
SaveOptions saveOptions = new ImageSaveOptions();
InputEPSDocument.Save(TiffImageDevice, saveOptions);
// Get image bytes array
byte[][] TiffImagesBytes = TiffImageDevice.ImagesBytes;
//loop through image bytes array and add to tiff file
int ImageBytesCount = 0;
foreach (byte[] TiffImageBytes in TiffImagesBytes)
{
using (FileStream OutputTIFFFileConverted = new FileStream("OutputConvertedTIFFFile.tiff", FileMode.Create, FileAccess.Write))
{
OutputTIFFFileConverted.Write(TiffImageBytes, 0, TiffImageBytes.Length);
}
ImageBytesCount++;
}
}
}
}
@aspose-com-gists
Copy link

The code is obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment