How to convert AI, EPS, PDF, PS to Image file in C#?

It is possible to convert AI, EPS, PDF and PS to image file of choice.

This can be done different ways. I will show you how to do it using well recognized libraries for free. This requires 3 steps.

  1. We need a library that can read AI, EPS, PDF and PS. For this purpose, Download and install Ghostscript (GNU Affero General Public License).
  2. We need an ImageMagick (ImageMagick is a free and open-source software suite for displaying, converting, and editing raster image and vector image files. It can read and write over 200 image file formats), which help us write to image files. Luckily it is available for .net ( When you are done with step 1, start Visual Studio 2017/2019.
    1. Create new Solution, with project
    2. Added nuget package to your project.
  3. Now it is time to code 🙂

Now we are ready to see the code. The following sample method take a collection of files that is pdf, eps, ai, ps and/or other image formats from a folder and add each file to MagickImageCollection. Then it writes each file for instance with .jpg format and keep the original name in the output folder.

That is it. Here is the sample code:

public void ConvertToImage(string dest, MagickFormat format = MagickFormat.Jpg)
            using (var images = new MagickImageCollection())
                foreach (var file in _files)
                    var image = new MagickImage(file)
                        Format = format,
                        Depth = 8,

                foreach (var image in images)
                    var file = Path.GetFileNameWithoutExtension(new FileInfo(image.FileName).Name);
                    image.Write(Path.Combine(dest, $"{file}.{format.ImageExt()}"));


Source code.

ImageMagick have a tons of feature that is accessible for .net developers. I will write and added more features about ImageMagick for .net in my blog.

Leave a Comment