Graphics, Figures & Tables ⇒ eps to pstricks, pgf or eepic (impossible?)
eps to pstricks, pgf or eepic (impossible?)
Hello!
I would like to convert .eps graphics to LaTeX code like eepic, pgf, tikz or pstricks. Is there any way to do that?
I'm writing a thesis and I have scanned pictures (mainly greyscaled simple graphics) in .png format, having been converted by bmeps.exe to .eps format. I'd like to convert them to some kind of LaTeX code, but I hardly found any program which can do this task for me.(I mean the import, or if so, they don't support the export to LaTeX code) After giving the path of Ghostscript at TpX settings, it wrote that the .eps graphic cannot be opened, whereas another .eps graphic (exported from Geogebra) can be opened by TpX without further ado.
I also have a java program called eps2pgf. But when I'd like to convert the .eps (created from raster graphics) it writes:
ERROR: A PostScript error occurred.
ERROR: Type: Error: /undefined in (then a bunch of question marks)
ERROR: Operand stack (max top 10 items):
ERROR: (empty)
ERROR: Execution failed due to a PostScript error in the input file.
And that's all. The other solution would be to draw the graphics on my own, but (for instance by LaTeXPiX, JPicedt etc.) I'm not a master of drawing, so it would take too much time for me. And as it happens by these programs, the import of .eps graphics is not supported, only their own formats are prefered. Export is available mainly to eepic, pstricks and pgf/tikz (just like by Geogebra), but rarely for .eps or ordinary picture formats. Why is this? Is it a difficult task to open an .eps graphic then save it to LaTeX code? Does it depend on the content of .eps files? Vectorial .eps can be converted, raster versions not?
I would like to convert .eps graphics to LaTeX code like eepic, pgf, tikz or pstricks. Is there any way to do that?
I'm writing a thesis and I have scanned pictures (mainly greyscaled simple graphics) in .png format, having been converted by bmeps.exe to .eps format. I'd like to convert them to some kind of LaTeX code, but I hardly found any program which can do this task for me.(I mean the import, or if so, they don't support the export to LaTeX code) After giving the path of Ghostscript at TpX settings, it wrote that the .eps graphic cannot be opened, whereas another .eps graphic (exported from Geogebra) can be opened by TpX without further ado.
I also have a java program called eps2pgf. But when I'd like to convert the .eps (created from raster graphics) it writes:
ERROR: A PostScript error occurred.
ERROR: Type: Error: /undefined in (then a bunch of question marks)
ERROR: Operand stack (max top 10 items):
ERROR: (empty)
ERROR: Execution failed due to a PostScript error in the input file.
And that's all. The other solution would be to draw the graphics on my own, but (for instance by LaTeXPiX, JPicedt etc.) I'm not a master of drawing, so it would take too much time for me. And as it happens by these programs, the import of .eps graphics is not supported, only their own formats are prefered. Export is available mainly to eepic, pstricks and pgf/tikz (just like by Geogebra), but rarely for .eps or ordinary picture formats. Why is this? Is it a difficult task to open an .eps graphic then save it to LaTeX code? Does it depend on the content of .eps files? Vectorial .eps can be converted, raster versions not?
Re: eps to pstricks, pgf or eepic (impossible?)
What sort of LaTeX code you would expect from conversion of a raster image? What you are trying to do just doesn't make sense. Perhaps explain why do you need to convert those raster images in the first place and then we can try to find a solution to your real problem.
Cheers,
Tomek
Cheers,
Tomek
Re: eps to pstricks, pgf or eepic (impossible?)
Well, I would have liked to paste nicer pictures into my document than the scanned ones. But as I've read your post, I suppose that there is no way to convert eps graphics to LaTeX code. The only option for me is to redraw the scanned pictures as vectorial figures. LaTeX code would have been better because it is part of the .tex file, so there is no problem with portability as opposed to the .eps files. And as I made acquaintance with LaTeX, I would be glad if I can apply the graphical LaTeX codes as well.
But now I think I would use \includegraphics to paste the eps file into the document rather than pasting it as a LaTeX code. But the problem in this case is that the greyscale pictures sometimes have darker background than that of the document. So the pictures break the unity of background of the document.
I don't know how people paste beautiful figures into their documents, but I'm sure that not everyone has a talent for drawing. Even if programs try to help you, I wasn't able to draw a simple circular arc just as I wanted to, because you should give the centre of the circle which is unkown, if you just want to mark an angle.
So the conclusion is that if I want to have nice vectorial pictures of high standard, I should attend a computer graphical drawing course?
That's a bit ridiculous.
But now I think I would use \includegraphics to paste the eps file into the document rather than pasting it as a LaTeX code. But the problem in this case is that the greyscale pictures sometimes have darker background than that of the document. So the pictures break the unity of background of the document.
I don't know how people paste beautiful figures into their documents, but I'm sure that not everyone has a talent for drawing. Even if programs try to help you, I wasn't able to draw a simple circular arc just as I wanted to, because you should give the centre of the circle which is unkown, if you just want to mark an angle.

So the conclusion is that if I want to have nice vectorial pictures of high standard, I should attend a computer graphical drawing course?

That's a bit ridiculous.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
eps to pstricks, pgf or eepic (impossible?)
As long as the EPS file has no error, eps2pgf should work properly. Take a look at an example to learn how it works [1].
Depending on the complexity of the graphics you may draw them on your own with pgf/tikZ. You could attach one of your files as example to your next post so we may be able to offer some specific help or find alternatives.
And as Tomek already said, it makes no sense to convert a pixel based image format to a vector based format because you can't really benefit from the advantages.
[1] eps2pgf | TikZ example
Best regards and welcome to the board
Thorsten
Depending on the complexity of the graphics you may draw them on your own with pgf/tikZ. You could attach one of your files as example to your next post so we may be able to offer some specific help or find alternatives.
And as Tomek already said, it makes no sense to convert a pixel based image format to a vector based format because you can't really benefit from the advantages.
[1] eps2pgf | TikZ example
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
eps to pstricks, pgf or eepic (impossible?)
Hello!
Here is my attachment: There are 3 figures in the file. eps2pgf doesn't work with these files. On that webpage the tiger looks like as if it was drawn by a vector graphic program (Illustrator or something like that). It is too perfect! Don't you think so?
Well, as long as the bmeps.exe (MikTeX) works well, there shouldn't be any problem. Is it possible that bmeps doesn't work correctly?As long as the EPS file has no error, eps2pgf should work properly.
Here is my attachment: There are 3 figures in the file. eps2pgf doesn't work with these files. On that webpage the tiger looks like as if it was drawn by a vector graphic program (Illustrator or something like that). It is too perfect! Don't you think so?
Re: eps to pstricks, pgf or eepic (impossible?)
I've seen your pictures. They are fairly simple geometry drawings with a few text labels. I would use TikZ for something like this.
There are programs capable of converting rasterized line art to vector graphics but this doesn't make sense in your case. No program that I know of is capable of recovering geometric constructions with labels from a bunch of pixels. If you want drawings with some decent quality, you will have to spend some time and do them properly.
Cheers,
Tomek
There are programs capable of converting rasterized line art to vector graphics but this doesn't make sense in your case. No program that I know of is capable of recovering geometric constructions with labels from a bunch of pixels. If you want drawings with some decent quality, you will have to spend some time and do them properly.
Cheers,
Tomek
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
eps to pstricks, pgf or eepic (impossible?)
I can only confirm what Tomek said. Here's some code with pgf/tikZ just for your inspiration.
At some points the code surely can be improved. Could also be done with PSTricks.
Code: Select all
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc} % Enable Cork Encoding
\usepackage[utf8]{inputenc} % Input Encoding for special (national) characters
\usepackage{lmodern} % Latin Modern Fonts
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[thick]
% \draw[help lines](0,0) grid (6,3);
\draw(0,0.5)--(6,0.5)
(5.5,0)--(5.5,3);
\fill(0.5,0.5) circle (2pt)
(2.5,0.5) circle (2pt)
(4.5,0.5) circle (2pt)
(5.5,0.5) circle (2pt);
\draw(0.5,0.5)--(2.5,2.5) node[above left,midway]{$b$}
(4.5,0.5)--(2.5,2.5) node[above right,midway]{$b$}
(2.5,0.5)--(2.5,2.5) node[right,midway]{$c$};
\draw(0.5,0.5) node[below] {$P_1$}
(2.5,0.5) node[below] {$(-b,0)$}
(4.5,0.5) node[below] {$P_2$};
\end{tikzpicture}
\begin{tikzpicture}[thick]
% \draw[help lines](0,0) grid (6,5);
\draw(0,0.5)--(6,0.5)
(5.5,0)--(5.5,5);
\fill(0.5,2.5) circle (2pt)
(2.5,0.5) circle (2pt)
(4.5,2.5) circle (2pt)
(5.5,0.5) circle (2pt);
\draw(0.5,2.5)--(2.5,0.5)--(4.5,2.5);
\draw(0.5,2.5)--(2.5,4.5) node[above left,midway]{$b$}
(4.5,2.5)--(2.5,4.5) node[above right,midway]{$b$}
(2.5,0.5)--(2.5,4.5) node[right,midway]{$c$};
\draw(0.5,2.5) node[below left] {$P_1$}
(2.5,0.5) node[below] {$(-b,0)$}
(4.5,2.5) node[below right] {$P_2$};
\end{tikzpicture}
\begin{tikzpicture}[>=latex,thick]
% \draw[help lines](-4,-2) grid (4,4);
\draw[gray,thin,dotted](-3.9,-1.9) grid (3.9,3.9);
\draw[->](-4,0)--(4,0) node[below] {$\Re$};
\draw[->](0,-2)--(0,4) node[left] {$\Im$};
\draw(0,0) node[below left] {0}
(1,0.1)--(1,-0.1) node[below] {1}
(0.1,1)--(-0.1,1) node[left] {$i$};
\fill(3,2) circle (2pt) node[above right]{$3+2i$};
\end{tikzpicture}
\end{document}
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: eps to pstricks, pgf or eepic (impossible?)
Well, thanks for the code. I watched the tikz figures and I must admit that it is perfect.
What are the differences among the four graphic systems? (eepic, pgf, tikz, pstricks)
I'd like to learn the most simple one. I know that for example figures created by pstricks are not supported by pdflatex, but colours are supported in .dvi output.
And can you offer a drawing program that can generate latex code and easy to use, and of course support latex labels? Did you use a program for creating the code or did you write it by heart?
What are the differences among the four graphic systems? (eepic, pgf, tikz, pstricks)
I'd like to learn the most simple one. I know that for example figures created by pstricks are not supported by pdflatex, but colours are supported in .dvi output.
And can you offer a drawing program that can generate latex code and easy to use, and of course support latex labels? Did you use a program for creating the code or did you write it by heart?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
eps to pstricks, pgf or eepic (impossible?)
Well, (e)epic as well as pict2e extend the standard LaTeX picture environment. They are simple to use but still very limited. tikZ is some kind of front-end for pgf, which represents the basic layer. It's advantage is that it produces PDF as well as PS code thus is not bonded to a certain compiler engine. And this is the disadvantage of pstricks. It can only be used with the latex compiler engine. But this linking is broken off by the (auto-)pst-pdf package at cost of a much longer time for the compilation caused by several auxiliary runs. On the other side pstricks benefits from the powerful calculation abilities of the PostScript language. For pgf a math engine has been written in the basic layer. But it still lacks other features (for example 3D graphics).cocka wrote:[...] What are the differences among the four graphic systems? (eepic, pgf, tikz, pstricks) [...]
From my point of view none of those two packages is simpler than the other. Their syntax is similar. For both you have to take some time to learn the basics. pgf also supports colour in DVI files. And as I described above, pstricks is no longer depending on the latex compile engine.cocka wrote:[...] I'd like to learn the most simple one. I know that for example figures created by pstricks are not supported by pdflatex, but colours are supported in .dvi output. [...]
At the moment I'm not aware of such a program which doesn't mean that it is not existing. I wrote the code by hand. Most programs that can export certain code suffer from the fact that they don't max out all features. Thus writing by hand is more efficient than exporting code from a program and doing necessary corrections subsequently.cocka wrote:[...] And can you offer a drawing program that can generate latex code and easy to use, and of course support latex labels? Did you use a program for creating the code or did you write it by heart?
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
eps to pstricks, pgf or eepic (impossible?)
Additionally, Inkscape can import eps, postscript and pdf files and output pgf or tikz code. I never really used it but I ran several times over that plugin.