Rajasekar S

Rajasekar S

  • 1.9k
  • 84
  • 2.9k

How to convert eps file format to png file format ?

Aug 22 2018 12:24 AM
The following source code throws the out of memory exception. 
 
public static void ConvertImageFromOneFormatToAnother()
{
try
{
string filePath = @"C:\Workings\Rajasekar\FUSO_XmlToHtml\FUSO_XmlToHtml\bin\Debug\SupportingFiles\TA_Images\DMT\Gr00\00008.eps"; ;
byte[] imageData;
// Create the byte array.
var originalImage = Image.FromFile(filePath);
using (var ms = new MemoryStream())
{
originalImage.Save(ms, ImageFormat.Jpeg);
imageData = ms.ToArray();
}
// Convert back to image.
using (var ms = new MemoryStream(imageData))
{
Image image = Image.FromStream(ms);
image.Save(@"C:\Users\rajasekars\Desktop\00008.png");
}
}
catch (Exception)
{
throw;
}
}
 
 
 

Brought to you by:

Answers (2)