Rajasekar S

Rajasekar S

  • NA
  • 95
  • 6.3k

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;
}
}
 
 
 

Answers (2)