Latex tip - how to include graphics

Tools

First convert your PNG file to EPS format. For that the png2eps can be used. To make png2eps work you would need to install the following:
  1. pngcheck (part of netpbm)
  2. pngtopnm (part of netpbm)
  3. pnmtotiff (part of netpbm)
  4. tiff2ps (part of libtiff-tools)
  5. sed basename bc (should come default with your distro)

$ sudo aptitude install pngcheck libtiff4 libtiff-tools netpbm
$ wget http://www.henlich.de/media/png2eps/png2eps
$ chmod a+x png2eps
$ ./png2eps myimage.png > myimage.eps

Using graphics

\documentclass[a4paper,10pt]{article}
\usepackage{graphics}
\usepackage{graphicx}

\begin{figure}
\caption{some figure}
\begin{center}
\includegraphics[bb=0 0 438 476]{myimage.eps}
\end{center}
\end{figure}


NOTE: Although I prefer PNG, if you have a jpj file, the jpg2eps tool can be used.

[Source: A PNG to EPS convertor, Images in LaTeX]

Update:
I have found it much easier to create illustrations in Dia and export them directly in the eps format. Dia is available for Windows, Mac and Linux.

1 comment:

Unknown said...

Thanks!! ...this script helps a lot

Ravi