Possible Duplicate:
Converting .EPS to Image in C#
How to convert byte array to .eps image in C#?
I have a code which works with graphic images(.jpg, .png…) but it throws an argument exception when I’m converting to .eps format.
MemoryStream ms = new MemoryStream(byteArray, 0, byteArray.Length);
using (ms)
{
//saving image on current project directory
Image img = Image.FromStream(ms);
img.Save(Environment.CurrentDirectory + "file.eps");
}
From the code you’ve posted it seems that you only save an image to a file with *.eps extension. If it’s so, you don’t have to create a
MemoryStreamobject at all, just use this method:It should work for all types of files, but without verifying if the file content’s is a valid image. However, if you are sure what the file’s contents are, it should be good method to use in this case. This method, however, can throw a number of exceptions, so be sure to handle them appropriately.