Fails to Import EPS Properly

Bug #168448 reported by Raghos on 2007-03-06
4
Affects Status Importance Assigned to Milestone
Inkscape
Medium
Tom Davidson

Bug Description

Hi,

I often create complicated maps with Matlab, but I have not been able to
use Inkscape to edit them because lots of stuff goes wrong when I try. The
files are imported but text is missing (at the very least). I'm forced to
use illustrator (in windows)

I understand this might be a problem with Matlab/Illustrator, but I don't
have any problems opening this figures for printing with evince, gsview,
etc.

I've attached an example of a figure that is not imported properly.

Thanks

Raghos (raghos) wrote :
Raghos (raghos) wrote :

Originator: YES

A comment about this:

If I convert the matlab .eps file with:

pstoedit -f plot-svg example.eps > example.svg

and then I open it with Inkscape, it loads almost perfectly. I noticed
that adding the -pta option corrects a few font issues.

Is there a way to know how inkscape is trying to use pstoedit, and to
change it?

Bryce Harrington (bryce) wrote :

This is controlled by /usr/share/inkscape/extensions/eps_input.inx

It's using the following command:

pstoedit -f plot-svg $infile

However, I'm unable to run pstoedit on your eps file at all - it just hangs (processing??) and I have to kill it after several minutes.

Bryce Harrington (bryce) wrote :

Can you upload another (simpler) file that demonstrates the problem?

Changed in inkscape:
status: New → Incomplete

Hi Bryce,

Funny. The example I first uploaded can be processed with my version of pstoedit (v 3.45 in Debian/Sid). Anyways, I've attached a much simpler figure: just a dot plotted with axes going from 0 to 2. This time, inkscape doesn't complain, but no labels are shown in the axes. I don't think this file illustrate all of the issues in the original file, but it is a good place to start.

Also, my eps_input.inx doesn't seem to call pstoedit:

<inkscape-extension>
    <_name>EPS Input</_name>
    <id>org.inkscape.input.eps</id>
    <dependency type="extension">org.inkscape.input.ps</dependency>
    <dependency type="executable">gs</dependency>
    <input>
        <extension>.eps</extension>
        <mimetype>image/x-encapsulated-postscript</mimetype>
        <_filetypename>Encapsulated Postscript (*.eps)</_filetypename>
        <_filetypetooltip>Encapsulated Postscript</_filetypetooltip>
        <output_extension>org.inkscape.output.eps</output_extension>
    </input>
    <script>
        <command reldir="path">gs -q -sDEVICE=pswrite -sOutputFile=- -dNOPAUSE -dBATCH -dSAFER -dDEVICEWIDTH=250000 -dDEVICEHEIGHT=250000</command>
        <helper_extension>org.inkscape.input.ps</helper_extension>
    </script>
</inkscape-extension>

Cheers.

Following up on this: I've obtained the best results doing by using the following extension (which I called eps_input.inx too) in ~/.inskcape/extensions :

<inkscape-extension>
    <_name>EPS Input</_name>
    <id>org.inkscape.input.eps</id>
    <dependency type="executable">pstoedit</dependency>
    <input>
        <extension>.eps</extension>
        <mimetype>image/x-encapsulated-postscript</mimetype>
        <_filetypename>Encapsulated Postscript (*.eps)</_filetypename>
        <_filetypetooltip>Encapsulated Postscript</_filetypetooltip>
        <output_extension>org.inkscape.output.eps</output_extension>
    </input>
    <script>
        <command reldir="path">pstoedit -f plot-svg -mergetext -ssp </command>
    </script>
</inkscape-extension>

the -ssp option seems to help with some fonts being rendered incorrectly and the -mergetext... well, it merges text otherwise broken into individual characters.

The resulting SVG opens fine (even rather complex figures) and can be edited. However, for some reason, if I try to add text it defaults to a font size of 8640!!! I've attached map.svg so you can check it out.

I guess matlab produces eps from hell.

A last comment on this:

I've now managed to succesfully import and edit very complicated matlab-generated eps figures using the above extension and by, after opening the document with inkscape, copying the figure (the entire object) onto a new document.

Hope this helps other people.

Tom Davidson (tjd-mit) wrote :

The current SVN source uses:
 <command reldir="path">pstoedit -f plot-svg</command>

You report that you also use the -mergetext and -ssp flags to pstoedit The man page for pstoedit gives the following info on these options:

[-mergetext]
               In order to produce nice looking text output, programs produc-
              ing PostScript files often split words into smaller pieces which
              are then placed individually on adjacent positions. However,
              such split text is hard to edit later on and hence it is some-
              time better to recombine these pieces again to form a word (or
              even sequence of words). For this pstoedit implements some
              heuristics about what text pieces are to be considered parts of
              a split word. This is based on the geometrical proximity of the
              different parts and seems to work quite well so far. But there
              are certainly cases where this simple heuristic fails. So please
              check the results carefully.

       [-ssp] simulate sub paths. Several output formats don’t support
              PostScript pathes containing sub pathes, i.e. pathes with inter-
              mediate movetos. In the normal case, each subpath is treated as
              an independent path for such output formats. This can lead to
              bad looking results. The most common case where this happens is
              if you use the -dt option and show some text with letters like
              e, o, or b, i.e. letter that have a "hole". When the -ssp option
              is set, pstoedit tries to eliminate these problems. However,
              this option is CPU time intensive!

Did you find that these provided a big improvement in the quality of the import? Do you think they ought to be enabled by default?

Changed in inkscape:
assignee: nobody → tjd-mit
importance: Undecided → Medium

Hi Tom,

The -mergetext option definitely helped with long text strings, which otherwise would be separated into individual characters. I didn't do extensive texting, but it didn't seem to create any issues. I'm afraid I don't remember why I enabled the -ssp option, but I was trying to open a series of simple and complex .eps files (including an .eps with the MIT logo I was trying to use :) ) and this gave me the best results. Sorry I don't recall what the problem was.

Also notice my comment above: this only really works if after you import the eps you copy the entire object to a new document. This seems like a bug.

Cheers.

graben (info-translucidedesign) wrote :

I confirm this bug.

I have v 0.46 installed.

To import the attached file I had to write this in my /usr/share/inkscape/extensions/eps_input.inx file :
pstoedit -f plot-svg -ssp

I don't know if -mergetext do something usefull to me yet.
However -ssp prevent letters like o, a or other letters having a hole on them from beeing incorrectly displayed (see attached file)

bbyak (buliabyak) wrote :

ps/eps import switched to ghostscript in svn, all these files now import ok

Changed in inkscape:
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers