A script for inspecting the properties of EPS Files
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

EPS stands for Encapsulated PostScript. It's is a file extension for a vector graphics file format used in vector-based images in Adobe Illustrator.

I would like a script that checks an EPS file programmatically (use ANY LANGUAGE YOU WANT) for certain issues. That is, check their properties with without actually opening them with Adobe app.

I will award the bounty to any script that accepts an eps file and checks at least 2 of these properties (as many as possible would be nice):

  1. Check if any sublayer is locked (example file)
  2. Check what the color profile(s) in the eps file. (example file)
  3. Check if all fonts of text have been converted to outlines. (example file)
  4. Check if any vectors extend outside of the artboard. (example file)
  5. Check if the eps file contains multiple windows or multiple artboard. (example file)
  6. Check if the eps file is corrupted. (example file)
  7. Check if the eps file is legacy or compatible with Illustrator version 8 or 10. (example file)


Someone suggested to me an alternative approach might be to use Adobe's sdk for Illustrator and script it to do these things automatically with Illustrator + Javascript.

The best possible way to go is c# + ghostscript,If its okay with you I can try in c#.Thanks
Codeword over 2 years ago
@Codeword I don't quite understand, why do you think microsoft c# is helpful here?
mr142 over 2 years ago
yes, I think c# is helpful because there is a library (magic.net) + ghostscript is the only way to go, because, there aren't many libraries available apart from a java library maybe, as far as I know, to read eps file.So you will need Ghostscript for sure.
Codeword over 2 years ago
in order to be fully accurate, we should admit that ghostscript lib is available for python too )
guy_do_or_die over 2 years ago
@codeword @guydoor_die python would be preferred, but I'll accept anything that works :)
mr142 over 2 years ago
Do you have .eps samples with those properties?
gabrielsimoes over 2 years ago
@gabrielsimoes Adding some example files now!
mr142 over 2 years ago
@guydoor_die @Codeword I've added the example files, to check your code with.
mr142 over 2 years ago
Hey, mr142., how are you ? Do the following and see if these are the information you need as I am not sure, I this the the max I can help you at this point. steps 1. Download ghostscript https://www.ghostscript.com/download/ 2. Download imagemagick https://www.imagemagick.org
Install the above software and 3. open command prompt and navigate to the path where the .eps files are present and then 4. run identify -verbose example.eps and you will be displayed all the information possible by using this method. Check if any of the information is helpful This is the as far as I can help you here at this point in time, I am commenting as nobody is responding and so just wanted to help you. Thank you
Codeword over 2 years ago
@Codeword I tried using identify as you suggested, unfortunately, it seems to give no information about deeper things like if a layer is locked or not, these detailed are still somewhere inside the binary adobe postscript sections of the file
mr142 over 2 years ago
If anyone has taken a worthy stab at any of them, please post your code and I'll award the bounty.
mr142 over 2 years ago
Hello, mr142 Did you find color profile in the information by using the identify -verbose example.eps.Thank you.
Codeword over 2 years ago
identify -verbose example.eps does show a color profile, but isn't the same as checking if all objects have the same color profile modes, when you try to open up the example file for Issue #2, you'll get a pop up that says "there are multiple color profiles used... pick one" even though the identitfy command's output lists only one profile - this behavior is what I'd like to detect.
mr142 over 2 years ago
Okay, but let me make this clear to you, that even if I make a program it will only output the color profile as my program will use imagemagic + ghostscript. Sorry for this, but there aren't any other library I know, which can help us in this matter.This is best I can help you.Let me know what you think.
Codeword over 2 years ago
@Codeword whatever insights your code could provide would be worthwhile I think!
mr142 over 2 years ago
Okay, then great, I will try to come up with the best I can, you will have to be patient. Right now I can provide you with a script which will show the limited information. But I want to try a bit more and see if there's anything more that can be done regarding this.Just be patient for know, I will post the solution 1 day before this bounty ends. Thanks.
Codeword over 2 years ago
awarded to Codeword

Crowdsource coding tasks.

1 Solution

Winning solution

Hello mr142, I tried as you suggested, using Adobe's sdk + javascript. But let me tell you this, you cannot run the javascript code in standalone. For this, you will need to open illustrator(manually) and import the js code and run from there like this https://github.com/jtnimoy/scripting-for-illustrator-tutorial.
Even if do this you will not be able to get all the information you need, I have read the documentation pdf.
At this point the best we can do here is the code below
Note : For c# code, you need to install ghost script + imagemagik

If you want the python version then use the code below
Note: For python you will need a package call pillow installed.Make sure you have that
Recommende way

from PIL import Image
from pprint import pprint
im = Image.open('issue_5_multiple_windows.eps')  # your eps file here

pprint(vars(im))  # output containg various infomation

# output expected: something like below
{'_exclusive_fp': True,
 'category': 0,
 'decoderconfig': (),
 'decodermaxblock': 65536,
 'filename': 'issue_5_multiple_windows.eps',
 'fp': <open file 'issue_5_multiple_windows.eps', mode 'rb' at 0x01893288>,
 'im': None,
 'info': {'+ procset Adobe_AGM_Core 2.0 0': '',
          '+ procset Adobe_AGM_Utils 1.0 0': '',
          '+ procset Adobe_CoolType_Core 2.31 0': '',
          '+ procset Adobe_CoolType_Utility_MAKEOCF 1.23 0': '',
          '+ procset Adobe_CoolType_Utility_T42 1.0 0': '',
          'AI8_CreatorVersion': '20.0.0',
          'BoundingBox': '0 0 800 800',
          'CMYKCustomColor': '',
          'CreationDate': '9/18/17',
          'Creator': 'Adobe Illustrator(R) 20.0',
          'CropBox': '0 0 800 800',
          'DocumentCustomColors': '',
          'DocumentData': 'Clean7Bit',
          'DocumentFonts': '',
          'DocumentNeededFeatures': '',
          'DocumentNeededFonts': '',
          'DocumentNeededResources': '',
          'DocumentProcessColors': 'Cyan Magenta Yellow Black',
          'DocumentSuppliedFeatures': '',
          'DocumentSuppliedResources': 'procset Adobe_AGM_Image 1.0 0',
          'For': 'Tim Goldman',
          'HiResBoundingBox': '0 0 800 800',
          'I9_PrintingDataBegin': '',
          'LanguageLevel': '2',
          'PS-Adobe': '3.1 EPSF-3.0',
          'Pages': '1',
          'RGBCustomColor': '',
          'Title': 'bdaycake10 [Converted].eps'},
 'mode': 'RGB',
 'palette': None,
 'pyaccess': None,
 'readonly': 1,
 'size': (800, 800),
 'tile': [('eps', (0, 0, 800, 800), 32, (1018044, [0, 0, 800, 800]))]}


If you want c# version then see below Recommed way is using the python code as it shows more info

For c# code place all the eps file inside you bin -> debug folder of your project

using System;
using System.Collections.Generic;
using System.Text;

using System.IO;

using ImageMagick;

namespace eps
    class Program
        static void Main(string[] args)
             foreach (var epsFile in Directory.GetFiles(@"C:\Users\Deepak pc\Documents\Visual Studio 2010\Projects\eps\eps\bin\Debug", "*.eps"))
                 using (var image = new MagickImage())

                     Console.WriteLine("file: {0}   Width: {1}", epsFile, image.Width);
                     Console.WriteLine("file: {0}   Height: {1}", epsFile, image.Height);
                     Console.WriteLine("file: {0}   color space: {1}", epsFile, image.ColorSpace);
                     Console.WriteLine("file: {0}   Format: {1}", epsFile, image.Format);
                     Console.WriteLine("file: {0}   Density.X: {1}", epsFile, image.Density.X);
                     Console.WriteLine("file: {0}   Density.Y: {1}", epsFile, image.Density.Y);
                     Console.WriteLine("file: {0}   Density.Units: {1}", epsFile, image.Density.Units);


Test The code and let me know how it goes.Thank you