[texhax] Including tiff figures in LaTeX

Steve Schwartz s.j.schwartz at qmul.ac.uk
Fri Jun 25 12:01:22 CEST 2004


Leo,

You will get as many answers as there are people who try to do this
regularly. Here's mine:

> What do you guys recommend me to do in order to include tiff figures in
> LaTeX? I tried several ways, like converting the figures to Postscript
> (tiff2ps, gimp, Photoshop...), but the figures get very huge...

This is a bad idea (IMHO). There is no advantage to (e)ps here as the
original is a bitmap. If you want to insist on using an eps figure, I'd
suggest you convert it to a jpeg and use jpeg2ps (you might need to
fetch this from somewhere) to convert the jpeg to an eps. It turns out
that ps understands jpeg and jpeg2ps takes avantage of this to just wrap
the necessary postscript commands around the original jpeg, rather than
rendering it in ps (which is why your files end up so large). [I'm not a
graphics expert, so all the above explanation might be flawed, but not
too much I think/hope.]

Alternatively, convert the tiff to a bmp (using gimp, ...) which latex
understands. This has the advantage over jpeg in that it's loss-free.

> I am currently using dvipdf, but I'm looking forward to receiving
> sugestions.

If you want pdf output, my advice would be to use pdflatex instead. This
is my preferred route, with xpdf as my preferred previewer (acroread is
ok, but won't reload a document to the same page/magnification so it's a
bit less convenient). Of course (!) pdflatex and latex have virtually no
graphics formats in common (I assume you're using graphicx and
\includegraphics...). So...

Convert your tiffs to png format. png is very good and compact,
loss-free.

Convert your eps's to pdfs using epstopdf. The resulting pdf images are
also very compact. If you're unlucky, some of your eps's will fail to
convert. Run them through eps2eps to clean them up (which also crops the
bounding box to remove white space - though some applications put an a4
white box as a background which requires more work). Then epstopdf the
result. I believe \usepackage{epstopdf} will do this on the fly for you,
but I'd be inclined to do the conversion once manually and be done with
it.

By the way, if you want to retain flexibility to use either latex or
pdflatex, keep both sets of graphics files around, e.g., graph.eps and
graph.pdf, image.bmp and image.png, etc. and include them without any
suffix, e.g.

\includegraphics{graph}

LaTex will look for eps, bmp, ... in some order (which you can specify),
pdflatex will look for pdf, png, ... in some order...

so the appropriate graphic will always be found. There's more you can do
to specify graphics extensions and define commands for how they should
be handled. See the graphicx documentation and scratch your head.

Hope this helps.

Steve

-- 
+-----------------------------------------------------------------+
| Steve Schwartz               S.J.Schwartz at qmul.ac.uk            |
| Astronomy Unit                                                  |
| Queen Mary, Univ. of London  Tel: +44 (0)20 7882 5449           |
| Mile End Road                Fax: +44 (0)20 8983 3522           |
| London E1 4NS, UK            URL: www.space-plasma.qmul.ac.uk/  |
+-----------------------------------------------------------------+




More information about the texhax mailing list