[pdftex] Question about importing images into TeX/LaTeX documents...

Reinhard Kotucha reinhard at kammer.uni-hannover.de
Fri Jan 3 02:03:39 CET 2003

>>>>> "Giuseppe" == Giuseppe Greco <giuseppe.greco at bluewin.ch> writes:

    > I use to produce graphics in PNG format, and I need to generate
    > PDF as well as PS output.  To accomplish that, I have to keep
    > the same image twice: one in PNG format and another one in EPS
    > format.

    > I would like to know if there is a way to keep the image just in
    > PNG or PS format and be able to generate either PDF output or PS
    > output.

Yes, of course you can convert the final pdf file (produced by pdftex)
to ps using either acroread or pstoeps (which comes with xpdf).

It is also possible to generate a dvi file first and then convert it
to ps using dvips and to pdf using dvipdfm.  But I suppose that
dvipdfm is not in texlive yet.

The first way is the easiest.  Just forget everything about ps until
your document is ready.

If you want to use pdftex for pdf and dvips for ps you have to provide
two files for each picture, but this is usually no problem.

If you are using the LaTeX graphicx package, it is important that you
specify the filename without any extension,
i.e. \includegraphics{name_without_extension}. 

LaTeX will then find the proper file automatically.

Though pdftex is able to include png files directly, inclusion of pdf
files is much faster.  So it's not a bad idea to provide pdf files.

A very good tool to convert bitmap graphics is the convert utility
from ImageMagick.  See http://www.imagemagick.org .

The conversion can be done automatically, for instance under UNIX:

for file in *.png ; do
    convert $file.png $file.eps
    convert $file.png $file.pdf

    > I know, it would be possible to keep the image just in EPS
    > format, generate a DVI file, and then from the DVI file generate
    > either the PDF or PS output. The problem by doing so, is that
    > the quality of the PDF output is really poor!  I tried to load
    > the 'times.sty' package: well, the result was better, but not so
    > good as PDF output generated via pdflatex.

I don't know which fonts are used by the latest texlive, but the next
version will certainly use scalable fonts always by default.

You can avoid all this trouble if you use pdftex and create the ps
file from the final pdf file as explained above.


Reinhard Kotucha			             Phone: +49-511-27060390
Marschnerstr. 25
D-30167 Hannover	              mailto:reinhard at kammer.uni-hannover.de
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.

More information about the pdftex mailing list