Monday, June 25, 2007

Edit eps on linux

There are many tools for converting between the formates eps, pdf, ps and latex but unfortunately
there are not supported by the most of open source vector graphics programs.
Our first task is to convert the eps file in to the native format of skencil. For this we will use the pstoedit program (standard package in most of distributions).


pstoedit -dt -f sk my_file.eps my_file.sk

The -dt flag is very important, which will convert the postscript fonts to polygons.

Now, we need a second program called "skconvert" included in the skencil package. If it is not included as standard package in your Linux distro, you can download it from here
After the installation you are ready to convert the sk file to svg


skconvert my_file.sk my_file.svg


The resulted svg file can be now easily imported by Xara or Inkscape .

Here is a nice poster created by this technique.

"Structurally dynamic spin market networks" [5MB]

The resulted graphics is a combination of latex, eps and svg graphics.

Pstoedit may have problems with some of the EPS files. The solution is to convert those files to a Level 1 EPS (thanks to cengiz for this useful comment):

eps2eps -dLanguageLevel=1 input.eps output.eps

Another solution of EPS editing is to convert the EPS to a PDF file using epstopdf. The big news that PDF can be imported as a vector graphics by Inkscape 0.46 which is already included in Ubuntu Hardy Heron Beta release.

FOR ONLINE EPS2SVG CONVERSION VISIT: eps2svg.info

10 comments:

Anonymous said...

the png link is broken

Also,
converting font to polygons sounds like defeating much of the purpose for me.

Zoltan Kuscsik said...

the link is fixed

Anonymous said...

thank you very much for this information, it has been of much value to me. In fact, the import function of inkscape (based on pstoedit) broke matlab graphs but with your commands it worked fine. So thanks AGAIN :)

cengiz said...

Thanks for this nice tutorial on getting SVGs from EPSs. However, i have arecurring problem on some EPS files I got from external sources. They have some images embedded in them, and unfortunately pstoedit is unable to transform them to SK or FIG formats. I get this error:

$ pstoedit -dt -f sk sample.eps sample.sk
pstoedit: version 3.44 / DLL interface 108 (build Sep 25 2007 - release build - g++ 4.2.1 (SUSE Linux)) : Copyright (C) 1993 - 2006 Wolfgang Glunz
Warning: Level 2 version of image and imagemask not supported for this backend (due to lack of support for bitmaps on intermediate files)

Do you have any intuition on how to avoid this error?

Many thanks..

cengiz said...

I am answering my own question :)

Apparently, you can convert the foreign EPS into a strict "level 1" postscript file by using the eps2eps command:

$ eps2eps -dLanguageLevel=1 input.eps output.eps

pstoedit no longer complains about these files. As a shortcut to what you described above, you can run inkscape directly on the EPS file and it will convert it into SVG by running pstoedit automatically:

$ inkscape output.eps

It works for me!

jpax said...

Hi there! thanks a lot for your post, I can breath now :P I got used to run my virtualbox for open Corel Draw and save that EPS into an SVG file.

XD

Anonymous said...

Thanks a lot! This was very helpful.

JustinH said...

Thanks! I have spent most of this afternoon searching for a way to edit eps files in linux. This method is the first one I have found that works.

Anonymous said...

Yes, helpful!

Fucatus said...

Very nice, you saved me a lot of time. Thank you very much!