Problems importing EPS

Bug #190424 reported by Tim Holy
6
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
bbyak

Bug Description

Using version pre0.46 (built from SVN on Feb. 9, 2008), importing EPS files works inconsistently and, depending on the particular strategy chosen, with a frustrating bug. This is related to multiple unresolved bug reports marked with many different statuses and priorities (#168448, #169125, #168777, #168370). The issues were largely worked out in a previous report (#168777), but the bug triager closed it because it was "messy" and encouraged a fresh report. So, here's the fresh report.

This bug affects anyone who attempts to edit an EPS file produced by an external program (e.g., matlab, gnuplot, and even files produced by Inkscape and saved as EPS). A common workflow that leads one to quickly encounter this bug is using Inkscape to combine files produced by different programs into a single figure (e.g., for a scientific publication).

Steps to reproduce the problem:
1. Starting with a blank canvas in Inkscape, draw something (e.g., a circle)
2. Save as EPS

Now, there are (at least) 3 methods to import this file into Inkscape, and the outcome is bad, in different ways, for two of the three methods:
1. Import through the GUI, #1: open the file in the file dialog (Ctrl-O). This seemingly works fine.
2. Import through the GUI, #2: start with a blank canvas and "import" the file (choose "Import" under the File menu, Ctrl-I). The odd thing here is that the imported graphic is very, very small. Other than this glitch, it appears to work correctly.
3. Import by manually running "pstoedit -f plot-svg" from the command line to convert the EPS file to SVG: this method produces the biggest problems. It initially appears to work well, but then from that point on, if one tries to add text with the "text tool", the font sizes are very weird, ending up as a multiple of 720. A workaround is to open the SVG file in a different window, and copy & paste the graphic into the window you are working with.

According to previous discussions with developers, the bad behavior may in part be caused by problems with Inkscape's handling of a "viewboxes" element (see bug #168370) produced by pstoedit.

Tags: importing eps
Revision history for this message
Mike Wimmer (mike-wimmer) wrote :
Download full text (3.3 KiB)

I would like to add further information to this bug report. The problems I describe happen for me on inkscape 0.46-0ubuntu2, but the origin (in my opinion) of the problem, namely eps import through pstoedit -f plot-svg, has been there since May 2007. I will also add some files to reproduce these problems.

Inkscape shows several bugs when importing eps. Internally, inkscape uses pstoedit -f plot-svg to convert eps to svg. Some of the problems experienced in inkscape also happen in other programs, such as svg viewers as eog or firefox and are thus not a problem of inkscape, but due to pstedit creating messy svgs. Other problems however are inkscape specific.

Consider the file original.svg containing a rectangle and the letters aeodqb (which all contain some sort of white space fully enclosed by black lines). When this file is exported as EPS (original.eps), it displays nicely in all kind of applications, such as gv etc.

However, when this EPS file is opened again in inkscape, all kinds of problems happen:

A) Openining the EPS file in inkscape (as opposed to importing)
A.1) All the "holes" in the letters are filled
A.2) The bounding box does not enclose the figure, but is much larger. In addition, the figure is shifted outside the bounding box.
A.3) Probably due to the strange bounding box, inkscape creates some huge drawing area that you can scroll with the scroll bars. The figure is not centered, but at the upper left corner. It can be hard to find it again, when you scrolled away, simply because the figure is very tiny compared to the whole drawing area.
A.4) When inserting text, the text size is always increased to 23040 and cannot be made smaller.
A.5) The thickness of the contour lines is set to 720.
A.6) Eventually, after drawing some things, inkscape simply behaves weird and doesn't do anything useful any more.

B) Importing the EPS file
B.1) All the "holes" in the letters are filled
B.2) The bounding box does not enclose the figure, but is much larger.
B.3) The imported figure is tiny. In fact, it is so tiny that it is almost impossible to find it again, if you deselect it before making it bigger.
(The other problems of A don't appear here)

This confirms the observations of the previous bug report, and adds more information (filled letters, bounding box.) Unlike the previous bug reporter, I did not find any difference between opening an eps in inkscape and converting it before with pstoedit -f plot-svg. Both ways give the same behaviour for me.

Problems A/B.1 and A/B.2 are in fact a problem of the svg generated from pstoedit -f plot-svg . Consider the file svg-frompstoedit.svg and the screenshot showing eog displaying this svg (The same happens for firefox). The wrong bounding box and the filled letters also happen there. The problem of filled letters can be solved with the pstoedit option -ssp (see file svg-frompstoedit-wit-ssp.svg), but I haven't found a solution to the bounding box problem yet.

In contrast, previously inkscape used pstoedit -f sk and then skconvert to convert an eps to svg. Doing this manually (files sk-frompstoedit.sk and svg-fromskconvert.svg) and then opening the resulting svg works flawlessly.

As it is ...

Read more...

Revision history for this message
Mike Wimmer (mike-wimmer) wrote :
Revision history for this message
Mike Wimmer (mike-wimmer) wrote :
Revision history for this message
Mike Wimmer (mike-wimmer) wrote :
Revision history for this message
Mike Wimmer (mike-wimmer) wrote :
Revision history for this message
Mike Wimmer (mike-wimmer) wrote :
Revision history for this message
Mike Wimmer (mike-wimmer) wrote :
Revision history for this message
bbyak (buliabyak) wrote : Re: [Bug 190424] Re: Problems importing EPS

can you please:

- install latest ghostscript

- run ps2pdf on the eps file

- import the pdf into inkscape

and see if this fixes the problems?

if it does, i'll look into switching our ps/eps import to this route -
i don't trust pstoedit, it's partly proprietary and not actively
developed. skconvert is even worse.

another thing to investigate is uniconverter, which claims to import eps

if you can investigate these options thoroughly it would be very helpful

Revision history for this message
Mike Wimmer (mike-wimmer) wrote :

I didn't have time to install the latest ghostscript yet (which is 8.62), but I run some tests using the ghostscript 8.61 on Ubuntu Hardy. If it would be useful to run the same tests using 8.62, I can do this later this week.

I used "ps2pdf -dEPSCrop" to convert the eps files. Opening or importing the resulting pdf in inkscape worked well - all of the above mentioned problems did not occur for me. I checked the files given as examples in this big report, and additionally several other, much more complex eps files (including some messy ones that had been processed by different programs on different operating systems).

I only found minor problems - for example, if fonts were only embedded in the eps file but not present in the operating system, inkscape converted the font to some other, existing font. However, I think that this is no major concern.

Overall, using ps2pdf worked quite well for me. Of course, it would be good if others could also try on their machines ...

Revision history for this message
Tim Holy (holy-wustl) wrote :

Converting to a PDF (I used epstopdf) and importing that way works much better for me. Sounds like a good solution.

Revision history for this message
Alvin Penner (apenner) wrote :

at the moment, support for .eps conversion within uniconv is limited

see : http://sk1project.org/forum/topic.php?forum=2&topic=39

Revision history for this message
Tim Holy (holy-wustl) wrote :

Any more action on this bug? Could it at least be marked "confirmed"?

Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
Changed in inkscape:
assignee: nobody → buliabyak
Revision history for this message
bbyak (buliabyak) wrote :

ps/eps import switched to ghostscript in svn, this file imports ok

Changed in inkscape:
status: Confirmed → Fix Released
Revision history for this message
Tim Holy (holy-wustl) wrote :

Great! I just compiled from SVN, and after using it (for only a minute or so...) the EPS import seems much improved.

Revision history for this message
Thomas Holder (speleo3) wrote :

font size issue fixed in svn revision 20284

Revision history for this message
Tim Holy (holy-wustl) wrote :

I'm looking forward to testing it. Many thanks, Thomas!

Revision history for this message
Charlied (empty-wallet) wrote :

Not sure if this is correct place to raise this, but ...

Vista OS, v0.47

Click link http://www.inkscapeforum.com/viewtopic.php?f=5&t=797&start=25 to view problem i'm seeing

Revision history for this message
Alvin Penner (apenner) wrote :

could you attach the .ps file, with a description of the problem?

Revision history for this message
Tim Holy (holy-wustl) wrote :

Since I was the original reporter, I should provide more recent feedback: on Kubuntu Karmic 9.10, running Inkscape 0.47pre4 r22446 (Oct 14 2009), this issue is resolved for me. Thanks to the developers for a wonderful program and a wonderful bugfix!

The screenshots on the page that Charlied linked to seem different from the problem I was originally experiencing, so it is likely a slightly different issue.

Revision history for this message
Charlied (empty-wallet) wrote :
Revision history for this message
Charlied (empty-wallet) wrote :

Click on link i posted and you can see that when opening with Inkscape, objects go missing, text goes missing and some objects get trimmed from original size..

Hope these uneducated comments help

Revision history for this message
Charlied (empty-wallet) wrote :

Also when i try Open with > inkscape

I get a pop up stating

"Inkscape has received additional data from the script executed. The script did not return an error, but this may indicate the results will not be as expected.
ps2pdf failed:"

"Access is denied.

Access is denied.

Access is denied.

Access is denied.

Unable to open command line file _.at"

There are no problems Opening with GSview or Importing to Gimp.

Revision history for this message
sas (sas-sas) wrote :

I opened Charlied's EPS file in Inkscape 0.47, and see that there is no text or blue ellipse, and the red rectangle is clipped to the page. However, I'm not sure that this behaviour is wrong, since the text, the blue ellipse and the missing piece of the red rectangle are all outside the bounding box specified by the EPS file.

Revision history for this message
Charlied (empty-wallet) wrote :

To save > rubber band all objects,> Document properties> Fit Page to selection

Saved .svg files all objects where they should be when re-opened . EPS files saved and re-opened in GS View and Gimp Imports all objects where they should, be

Clipping as desicribed by sas when Importing back into Inkscape

Hope this helps.

Revision history for this message
su_v (suv-lp) wrote :

@sas - I think eps import could be improved - the fallback papersize of US letter really is an issue when importing EPS (sometimes even PS) into Inkscape - see

Bug #264044 in Inkscape: “inkscape19770 import/open eps clips drawings larger than sheet width”:
<https://bugs.launchpad.net/inkscape/+bug/264044>
Bug #471199 in Inkscape: “Importing EPS Clips Image”:
<https://bugs.launchpad.net/inkscape/+bug/471199>

Using a locally installed custom import extension which calls ps2pdf with an (at the moment arbitrary) bigger document size imports contents of 'test.eps' un-clipped and un-cropped into Inkscape. There the page can be resized to fit the drawing if needed. Ideally one would write a python script that obtains the correct document size from the bbox of the EPS file and hands it over to ps2pdf (similar to the EPS import dialog in GIMP which has the option to 'Try Bounding Box').

code-snippet from custom input extension script 'ps2pdf-ext-LeWitt.py'
 run('ps2pdf -sPAPERSIZE=a0 "%s" "%%s"' % sys.argv[1].replace("%","%%"), "ps2pdf")

Revision history for this message
su_v (suv-lp) wrote :

screenshot of GIMP 2.6.8 EPS import dialog for 'test.eps'

Revision history for this message
sas (sas-sas) wrote :

As regards the "Access is denied" messages that Charlied reports, someone else has filed a bug report about this (bug #512681), and I've posted a patch there.

su_v (suv-lp)
tags: added: eps importing
Revision history for this message
su_v (suv-lp) wrote :

The file attached to comment #20 imports without any missing, clipped or cropped elements if using '-dEPSCrop' as argument in the call of ps2pdf (modified input extension for EPS files), as proposed here in comment #9 and in recently filed bug #649842.

Tested with Inkscape 0.48+devel r9815 (gs 8.71) on OS X 10.5.8.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.